Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OnExec() #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add OnExec() #14

wants to merge 2 commits into from

Conversation

arp242
Copy link
Contributor

@arp242 arp242 commented Dec 24, 2022

syscall.Exec() will unapologetically replace/kill the current process. This is good in many cases, but in some cases you really want to run some code before it does so.

In my case, the Go backend also starts a webpack nodejs process to rebuild the frontend on changes, but the node process will keep running as an orphan because the parent died. With OnExec() the parent can instruct the children to kill themselves. There are probably some other use cases as well.

It would be nicer to add this to reload.Do(), but we can't really do that without an incompatible change.

syscall.Exec() will unapologetically replace/kill the current process.
This is good in many cases, but in some cases you really want to run
some code before it does so.

In my case, the Go backend also starts a webpack nodejs process to
rebuild the frontend on changes, but the node process will keep running
as an orphan because the parent died. With OnExec() the parent can
instruct the children to kill themselves. There are probably some other
use cases as well.

It would be nicer to add this to reload.Do(), but we can't really do
that without an incompatible change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant