python - Popen new process group on linux -
i spawning processes popen (python 2.7, shell=true) , sending sigint them. appears process group leader python process, sending sigint pid returned popen, pid of bash, doesn't anything.
so, there way make popen create new process group? can see there flag called subprocess.create_new_process_group, windows.
i'm upgrading legacy scripts running python2.6 , seems python2.6 default behavior want (i.e. new process group when popen).
bash not handle signals while waiting foreground child process complete. why sending sigint
not anything. behaviour has nothing process groups.
there couple of options let child process receive sigint
:
- when spawning new process
shell=true
try prependingexec
front of command line, bash gets replaced child process. - when spawning new process
shell=true
append command line& wait %-
. cause bash react signals while waiting child process complete. won't forward signal child process. - use
shell=false
, specify full paths child executables.
Comments
Post a Comment