Nix-shell --run and kill signals

I’m currently wrapping up a development environment that requires multiple services to be launched. To do so, I’m launching a supervisord instance that triggers some nix-shell --run directly to the local development version of the required services.

Using supervisorctl repl I can easily restart all the services of this environement, but there is an issue: When I stop a service, the shell exits, but the subsequent process started by the --run argument keeps running.

I’ve been able to reproduce the issue manually, if I kill the bash itself, the processes inside keeps running. the same behavior applies to the --command argument.

How can I make sure that nix-shell kills the child process ?

4 Likes

I think you should use exec like “–run ‘exec ’”.