Skip to content

Commit

Permalink
First interrupt before killing a daemon on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
bartjkdp committed Nov 30, 2019
1 parent 45e41bb commit 15d338f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (
"io"
"os"
"os/exec"
"runtime"
"sync"
"time"

"github.com/cortesi/termlog"
)
Expand Down Expand Up @@ -157,6 +159,14 @@ func (e *Executor) Signal(sig os.Signal) error {
}

func (e *Executor) Stop() error {
// Windows does not support Interrupt
if runtime.GOOS == "windows" {
return e.Signal(os.Kill)
}

_ = e.Signal(os.Interrupt)

time.Sleep(2 * time.Second)
return e.Signal(os.Kill)
}

Expand Down

0 comments on commit 15d338f

Please sign in to comment.