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:

  1. when spawning new process shell=true try prepending exec front of command line, bash gets replaced child process.
  2. 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.
  3. use shell=false , specify full paths child executables.

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -