mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 07:22:50 -05:00
core: exit non-zero when SIGUSR1 is received (for systemd r estart)
This commit is contained in:
@@ -233,7 +233,14 @@ func runShellInteractive(session bool) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case sig := <-sigChan:
|
case sig := <-sigChan:
|
||||||
if sig == syscall.SIGUSR1 && !isSessionManaged {
|
if sig == syscall.SIGUSR1 {
|
||||||
|
if isSessionManaged {
|
||||||
|
log.Infof("Received SIGUSR1, exiting for systemd restart...")
|
||||||
|
cancel()
|
||||||
|
cmd.Process.Signal(syscall.SIGTERM)
|
||||||
|
os.Remove(socketPath)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
log.Infof("Received SIGUSR1, spawning detached restart process...")
|
log.Infof("Received SIGUSR1, spawning detached restart process...")
|
||||||
execDetachedRestart(os.Getpid())
|
execDetachedRestart(os.Getpid())
|
||||||
return
|
return
|
||||||
@@ -466,7 +473,14 @@ func runShellDaemon(session bool) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case sig := <-sigChan:
|
case sig := <-sigChan:
|
||||||
if sig == syscall.SIGUSR1 && !isSessionManaged {
|
if sig == syscall.SIGUSR1 {
|
||||||
|
if isSessionManaged {
|
||||||
|
log.Infof("Received SIGUSR1, exiting for systemd restart...")
|
||||||
|
cancel()
|
||||||
|
cmd.Process.Signal(syscall.SIGTERM)
|
||||||
|
os.Remove(socketPath)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
log.Infof("Received SIGUSR1, spawning detached restart process...")
|
log.Infof("Received SIGUSR1, spawning detached restart process...")
|
||||||
execDetachedRestart(os.Getpid())
|
execDetachedRestart(os.Getpid())
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user