Macos – OS X kill terminal processes

macosprocessterminal

I'm confused with closing terminal applications in OS X. Why processes are not killed after closing terminal app? For example I call python interpreter then close it with ctrl+z and when I try to close terminal it asks me about running python processes. Sorry for Russian in the screenshot but you can see 2 python processes(I called it two times).

OS X terminal screenshot

It's very annoying especially when you are working with serial port using minicom for example. You have to kill process manually after each call. Is there a way to kill them automatically?

Best Answer

When you press Ctrl+z you are sending a SIGTSTP ("terminal stop" signal) to a process currently running in foreground. It causes the process to suspend its operation, however the process still remains in memory.

You can resume a suspended process with fg (in foreground) or bg (in background) commands.

To kill a process you need to send a SIGINT ("interrupt" signal) which you can do by pressing Ctrl+c or a SIGKILL from another process (kill -s SIGKILL <pid>).

Why processes are not killed after closing terminal app?

They actually are killed and you are seeing a warning message that the suspended processes will be killed when you close the app.

Related Question