go - Signal other than SIGKILL not terminating process on Windows -


i launching simple java application through go, goal of proving go can send signal sigquit or sigterm, , java can catch , handle appropriately (i.e. shutdown gracefully). when run java program on command line , send ctrl+c, java program correctly catches signal.

however, when launch java program through go , attempt send process signal, java process neither terminated nor handle signal. 1 works sigkill, of course not caught, , kills process.

here relevant parts of go code:

start:

startchan := make(chan bool) go func(startchan chan<- bool) {     a.cmd = exec.command("java", "-jar", "c:\\code\\sigterm\\testapp.jar")     a.cmd.stdout = os.stdout     a.cmd.stderr = os.stderr      launcherr := a.cmd.start()     if launcherr != nil {         fmt.println("unable start app:" + launcherr.error())     }     startchan <- true }(startchan) 

stop:

func (a *app) stop(timeout time.duration) {   a.cmd.process.signal(syscall.sigquit) //does not work   a.cmd.process.signal(syscall.sigterm) //does not work   a.cmd.process.signal(syscall.sigkill) //works } 

this on windows, way. tried launching program (notepad) , got same results; is, sigkill worked. have confirmed go getting correct pid , forth, signal should going right place.

any ideas how can work?

this not seem supported stated in documentation:

https://godoc.org/os#process.signal

sending interrupt on windows not implemented.

also, see issue discussion more context on why not done:

https://github.com/golang/go/issues/6720


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -