When launching a process as a shell, what happens is that Popen creates a shell then the shell forks itself and calls exev system call to run the program we intended to run in the shell.
Popen
|
V
shell -fork-> another-shell
| |
V exev
|
V
external-command
We have access to the shell it self from self._process which we actually don't need. We need the pid of external-command instead.
This PR launches the spawned shell in a new group so that we can just kill the group all together when stop is called.
When launching a process as a shell, what happens is that
Popen
creates a shell then the shell forks itself and callsexev
system call to run the program we intended to run in the shell.We have access to the shell it self from
self._process
which we actually don't need. We need the pid ofexternal-command
instead.This PR launches the spawned shell in a new group so that we can just kill the group all together when
stop
is called.fixes #46