Added SIGTERM to linux systems on shutdown

Closes https://github.com/chromedp/chromedp/issues/274
This commit is contained in:
Killian Brackey 2019-02-24 23:12:46 -06:00 committed by Daniel Martí
parent 4cc9890745
commit b61de69d62

View File

@ -241,12 +241,15 @@ func (r *Runner) Shutdown(ctxt context.Context, opts ...client.Option) error {
}
}
// osx applications do not automatically exit when all windows (ie, tabs)
// osx and linux applications do not automatically exit when all windows (ie, tabs)
// closed, so send SIGTERM.
//
// TODO: add other behavior here for more process options on shutdown?
if runtime.GOOS == "darwin" && r.cmd != nil && r.cmd.Process != nil {
return r.cmd.Process.Signal(syscall.SIGTERM)
if r.cmd != nil && r.cmd.Process != nil {
switch runtime.GOOS {
case "darwin", "linux":
return r.cmd.Process.Signal(syscall.SIGTERM)
}
}
return nil