You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
418 B
26 lines
418 B
//go:build linux |
|
|
|
package interrupt |
|
|
|
import ( |
|
"lol.mleku.dev/log" |
|
"os" |
|
"syscall" |
|
|
|
"github.com/kardianos/osext" |
|
) |
|
|
|
// Restart uses syscall.Exec to restart the process. macOS and Windows are not |
|
// implemented, currently. |
|
func Restart() { |
|
log.D.Ln("restarting") |
|
file, e := osext.Executable() |
|
if e != nil { |
|
log.E.Ln(e) |
|
return |
|
} |
|
e = syscall.Exec(file, os.Args, os.Environ()) |
|
if e != nil { |
|
log.F.Ln(e) |
|
} |
|
}
|
|
|