Show More
@@ -343,9 +343,17 b' class pipeservice(object):' | |||||
343 | _restoreio(ui, fin, fout) |
|
343 | _restoreio(ui, fin, fout) | |
344 |
|
344 | |||
345 | def _initworkerprocess(): |
|
345 | def _initworkerprocess(): | |
346 |
# use a different process group from the master process, |
|
346 | # use a different process group from the master process, in order to: | |
347 | # process pass kernel "is_current_pgrp_orphaned" check so signals like |
|
347 | # 1. make the current process group no longer "orphaned" (because the | |
348 | # SIGTSTP, SIGTTIN, SIGTTOU are not ignored. |
|
348 | # parent of this process is in a different process group while | |
|
349 | # remains in a same session) | |||
|
350 | # according to POSIX 2.2.2.52, orphaned process group will ignore | |||
|
351 | # terminal-generated stop signals like SIGTSTP (Ctrl+Z), which will | |||
|
352 | # cause trouble for things like ncurses. | |||
|
353 | # 2. the client can use kill(-pgid, sig) to simulate terminal-generated | |||
|
354 | # SIGINT (Ctrl+C) and process-exit-generated SIGHUP. our child | |||
|
355 | # processes like ssh will be killed properly, without affecting | |||
|
356 | # unrelated processes. | |||
349 | os.setpgid(0, 0) |
|
357 | os.setpgid(0, 0) | |
350 | # change random state otherwise forked request handlers would have a |
|
358 | # change random state otherwise forked request handlers would have a | |
351 | # same state inherited from parent. |
|
359 | # same state inherited from parent. |
General Comments 0
You need to be logged in to leave comments.
Login now