Potentially resolve issue with os signals (#144)

* change error format

* capture SIGTERM for upstart, ignore SIGKILL

* for windows only notify on SIGINT
This commit is contained in:
SteelPhase
2018-08-22 20:15:10 -04:00
committed by Daniel Theophanes
parent 45244176fc
commit 8f267d80f2
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -11,6 +11,7 @@ import (
"os/signal"
"regexp"
"strings"
"syscall"
"text/template"
"time"
)
@@ -186,7 +187,7 @@ func (s *upstart) Run() (err error) {
s.Option.funcSingle(optionRunWait, func() {
var sigChan = make(chan os.Signal, 3)
signal.Notify(sigChan, os.Interrupt, os.Kill)
signal.Notify(sigChan, syscall.SIGTERM, os.Interrupt)
<-sigChan
})()
+2 -2
View File
@@ -268,7 +268,7 @@ func (ws *windowsService) Run() error {
sigChan := make(chan os.Signal)
signal.Notify(sigChan, os.Interrupt, os.Kill)
signal.Notify(sigChan, os.Interrupt)
<-sigChan
@@ -311,7 +311,7 @@ func (ws *windowsService) Status() (Status, error) {
case svc.Stopped:
return StatusStopped, nil
default:
return StatusUnknown, fmt.Errorf("unknown status %s", status)
return StatusUnknown, fmt.Errorf("unknown status %v", status)
}
}