-
Notifications
You must be signed in to change notification settings - Fork 420
Description
Issue
stripe listen process is orphaned (continues running) if parent process gets killed.
In development environment people often run stripe listen (with additional arguments) using wrapper scripts like foreman, forego, rails/rake tasks, etc. If those scripts are killed via kill -9 {script_pid} or sometimes kill {script_pid} - stripe listen will continue running as an orphan process.
foreman and others will properly handle SIGTERM kill {script_pid} (foreman kills child processes), but custom scripts and task runners like rails/rake (and others) will not.
Steps to reproduce
- Example script
foo:
#!/usr/bin/env bash
echo "Script pid is $$"
stripe listen- Make the script executable
chmod +x foo - Run the script
./foo, note script pid in the output - Check
stripe listenis running: commandps -ef | grep 'stripe listen'should output pid and command - Kill the parent script
./fooviakill {foo pid from step 2} - The output of
ps -ef | grep 'stripe listen'will showstripe listenis still running. This is not expected, and not wanted.
Expected Behavior
I would expect that long running stripe command like stripe listen will end if parent died.
Traceback
N/A
Environment
Tested on macOS Ventura 13.4, but I suspect this is applicable to any other OS.
stripe version 1.19.4
Comments
tailwindcss-cli had the same problem. They solved it by ending the process if stdin gets closed see commit (by Jose Valim!).
Then they had another problem with this approach which they solved by adding an argument to not end the process if stdin gets closed.
I also work with tailwindcss-cli (run it from scripts, etc) and I can say the behavior of their command is good, and pretty much expected.