cortesi / modd

A flexible developer tool that runs processes and responds to filesystem changes
MIT License
2.8k stars 128 forks source link

modd fails to kill process when run by `go run` #41

Closed llimllib closed 6 years ago

llimllib commented 7 years ago

With this modd.conf:

**/*.go {
    daemon +sigint: PGDATABASE=soapbox_dev PGSSLMODE=disable soapboxd
}

modd works perfectly.

With this one:

**/*.go {
    daemon +sigint: PGDATABASE=soapbox_dev PGSSLMODE=disable go run cmd/soapboxd/main.go
}

modd tried to kill the process but fails on mac os x. It hangs at:

15:57:58: daemon: PGDATABASE=soapbox_dev PGSSLMODE=disable go run cmd/soapboxd/main.go
>> starting...
2017/08/07 15:58:00 soapboxd listening on 0.0.0.0:9090
>> sending signal interrupt

I'm guessing that this has something to do with the parent process being go, rather than the daemon itself? Or something like that?

Soapboxd is a very basic grpc server, and I'm on go 1.8

cathykc commented 6 years ago

@llimllib did you find a resolution to this? Would love to know!!

llimllib commented 6 years ago

@cathykc I didn't, unfortunately!

cathykc commented 6 years ago

Ah sad :( let me know if you landed on another auto restart solution for go apps

zwhitchcox commented 6 years ago

This is the only thing I was wanting to do

bwiggs commented 6 years ago

Using a prep statement to build then running the executable worked for me.

dir/**/*.html {
    prep: go build
    daemon +sigterm: ./app
}
cortesi commented 6 years ago

This has been fixed in master. Processes are now spawned with a process group, and signals are sent to the entire process group. The root of the issue here was that go run was not passing signals to child processes.

Please re-open if you're still seeing problems on master. Version 0.7 should be out soon.

llimllib commented 6 years ago

Great, thanks!