fix signals
This commit is contained in:
parent
8959b13a0d
commit
b14e2ccfb1
1 changed files with 3 additions and 4 deletions
|
@ -84,11 +84,10 @@ func (cmd *LinuxCommand) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var signalChannel chan os.Signal
|
var signalChannel chan os.Signal
|
||||||
|
signalChannel = make(chan os.Signal, 1)
|
||||||
|
signal.Notify(signalChannel, unix.SIGINT, unix.SIGTERM)
|
||||||
|
|
||||||
if len(cmd.handlers) != 0 {
|
if len(cmd.handlers) != 0 {
|
||||||
signalChannel = make(chan os.Signal, 1)
|
|
||||||
signal.Notify(signalChannel, unix.SIGINT, unix.SIGTERM)
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
cmd.stdout, err = command.StdoutPipe()
|
cmd.stdout, err = command.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -227,8 +226,8 @@ func (cmd *LinuxCommand) Run() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signal.Stop(signalChannel)
|
|
||||||
close(signalChannel)
|
close(signalChannel)
|
||||||
|
signal.Stop(signalChannel)
|
||||||
cmd.wg.Wait()
|
cmd.wg.Wait()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue