CTRL+C doesn't properly kill a non-interactive shell

During development, I'm running a just-built web app in a bst shell. I can test the app in a browser as I work on it.

This gives me the following processes:

  PID TTY      STAT   TIME COMMAND
 1075 ?        Ss     0:01 /usr/lib/systemd/systemd --user
 2120 ?        Rsl   26:43  \_ /usr/libexec/gnome-terminal-server
32328 pts/4    Ss     0:00  |   \_ bash
14880 pts/4    Sl+    0:01  |   |   \_ /usr/bin/python3 /home/mathieu/.local/bin/bst shell app.bst ideascube
14890 ?        Ss     0:00  |   |       \_ /usr/bin/python3 /home/mathieu/.local/bin/bst shell app.bst ideascube
14893 pts/4    S+     0:00  |   |       \_ /usr/bin/bwrap ...
14894 pts/4    S+     0:00  |   |           \_ /usr/bin/bwrap ...
14895 pts/4    Sl+    0:00  |   |               \_ /usr/bin/python3.6 /usr/bin/ideascube

The systemd one is just my user session, the gnome-terminal-server is because I use GNOME Terminal, and the bash one is the interactive shell in which I'm running bst shell .... I included them to show the process hierarchy, as it shows something further down.

When I'm done, I hit ctrl+c to kill the app, which printed Aborted! in the console, terminating the app.

However, this does not give me back my bash prompt, bst is just hung there:

  PID TTY      STAT   TIME COMMAND
 1075 ?        Ss     0:01 /usr/lib/systemd/systemd --user
 2120 ?        Ssl   26:49  \_ /usr/libexec/gnome-terminal-server
32328 pts/4    Ss     0:00  |   \_ bash
14880 pts/4    Sl+    0:01  |   |   \_ /usr/bin/python3 /home/mathieu/.local/bin/bst shell app.bst ideascube
14890 ?        Ss     0:00  |   |       \_ /usr/bin/python3 /home/mathieu/.local/bin/bst shell app.bst ideascube

If I press ctrl+c a second time, then the parent bst process gets stopped, and I get back to a prompt.

However, something is left lingering:

  PID TTY      STAT   TIME COMMAND
 1075 ?        Ss     0:01 /usr/lib/systemd/systemd --user
 2120 ?        Ssl   26:49  \_ /usr/libexec/gnome-terminal-server
32328 pts/4    Ss     0:00  |   \_ bash
14890 ?        Ss     0:00  \_ /usr/bin/python3 /home/mathieu/.local/bin/bst shell app.bst ideascube

One of the BuildStream processes never exited, and it got reparented to the session systemd process.


I found about #40 (closed), but that was for interactive shells, whereas here I'm running a non-interactive command.

I would pretty much expect BuildStream to just pass the ctrl+c to the child command. In most cases, the child command would exit.

Edited by Mathieu Bridon