jpillora / overseer

Monitorable, gracefully restarting, self-upgrading binaries in Go (golang)
MIT License
2.32k stars 209 forks source link

Windows watchParent() fix #42

Closed chicknsoup closed 4 years ago

chicknsoup commented 4 years ago

Slave process watches its parent by sending Signal(0), but as stated in os/exec.go sending Interrupt on Windows is not implemented. This cause prog exits with status code 1 error.

// Signal sends a signal to the Process.
// Sending Interrupt on Windows is not implemented.
func (p *Process) Signal(sig Signal) error {
    return p.signal(sig)
}

This fix uses gopsutil to check for process existence on Windows.

jpillora commented 4 years ago

Thanks for the PR!

Looks like this supports linux and windows, but misses the other operating systems. See sys_*.go files for how to do with build comments

jpillora commented 4 years ago

Can probably be proc_slave_windows.go // +build windows and proc_slave_others.go // +build !windows (untested)

chicknsoup commented 4 years ago

Can probably be proc_slave_windows.go // +build windows and proc_slave_others.go // +build !windows (untested)

Thanks. I forgot other oses as I only build linux and windows binaries.

jpillora commented 4 years ago

Merged! Thanks :)

jpillora commented 4 years ago

Hey @chicknsoup I just added auto testing and the windows build is failing. See https://github.com/jpillora/overseer/actions/runs/65595163

I don't have a windows machine, can you please check this?

jpillora commented 4 years ago

I pushed a fix but needs testing