-
Notifications
You must be signed in to change notification settings - Fork 419
Description
Is your feature request related to a problem? Please describe.
An example use case:
gum spin --title "" --show-output -- curl -Ssfl https://am.i.mullvad.net/json
If my Internet connection is down, this can take a long time before it fails, so I often use Ctrl+C to send SIGINT
to the process to cancel it. This will successfully kill gum
, but the curl
command keeps running in the background.
Leaving curl
running in the background isn't such a terrible thing... UNLESS this is running in a subshell, like so:
json_output="$(gum spin --title "" --show-output -- curl -Ssfl https://am.i.mullvad.net/json)"
In this case, Ctrl+C kills gum, but the script hangs because the subshell waits for curl
to exit before proceeding. The net effect is that the spinner goes away, but it still takes another 20 seconds for my script to stop running.
Describe the solution you'd like
I'd like gum
to have a little bit of process supervision built-in. One or more of the following:
- forward any signals it receives (in this case,
SIGINT
) to the child processes that it spawns - make sure the child processes get terminated before
gum
exits - avoid exiting
gum
until the child process is dead
Describe alternatives you've considered
ugly hacks in my scripts that implement my own process supervision