mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
A signal killed the process mid-run and left the snapshot's copies of browser files in the temp dir. The run now stops at its next step, removes them, and ends by the same signal, so the exit status and calling scripts see what they did before. RFC-012 also keeps the list goldens in cmd.
22 lines
482 B
Go
22 lines
482 B
Go
//go:build !windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
func configureDoubleClickMode() {}
|
|
|
|
// exitBy ends the process by sig itself, as the signal would have, so a calling shell or script sees it was stopped.
|
|
func exitBy(sig os.Signal) {
|
|
signal.Reset(sig)
|
|
if s, ok := sig.(syscall.Signal); ok && syscall.Kill(syscall.Getpid(), s) == nil {
|
|
time.Sleep(time.Second) // the signal ends the process first unless it was ignored at start
|
|
}
|
|
os.Exit(1)
|
|
}
|