Closed wms closed 11 months ago
@wms I think this totally makes sense, and in fact, this was the behavior in v2 https://github.com/thefrontside/effection/blob/v2/packages/main/src/node.ts#L41-L42
So I think this would be an improvement for sure. Before merging there are a couple of issues that would have to be addressed.
I really like your work around by the way.!
Thank you sir, but credit goes to you folks in making the API clean enough to make the workaround slot in so nicely and not feel at all hacky. I'll put in a test case + parameterized interrupt handler.
@cowboyd Branch updated to include separate interrupts for each signal and test coverage.
@wms This looks great, and thanks for taking taking the time to contribute! This should be released some time next week.
Install interrupt handler for
SIGTERM
events, as commonly used by watchers/supervisors.@TODO: the interrupt fn always reports that the signal received was
SIGINT
even ifSIGTERM
was used. Parameterizeinterrupt
to correct report received signal?Motivation
The dev-mode supervision tool
tsx
sends aSIGTERM
to the child process when a change is detected; it would be nice for Effection to catch these too.Approach
Simply install the
interrupt
handler in response toSIGTERM
events just likeSIGINT
Alternate Designs
I've currently got the following baked into my Node app, which works, but would be nice to omit:
Possible Drawbacks or Risks
Maybe downstream users have custom behaviour bound to
SIGTERM
.TODOs and Open Questions
SIGINT
even ifSIGTERM
was used. Parameterizeinterrupt
to correct report received signal?