From: Millian Poquet Date: Thu, 13 Jun 2019 17:52:34 +0000 (+0200) Subject: [tesh] setsid -> setpgid(0,0) X-Git-Tag: v3.23~43^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/aae8d9f1052c3fca50cc5309809fa142ecf1b173 [tesh] setsid -> setpgid(0,0) As the cleanup function is based on process groups and not session ids, creating a process group rather than a session seems more adequate. Info: http://www.andy-pearce.com/blog/posts/2013/Aug/process-groups-and-sessions/ --- diff --git a/tools/tesh/tesh.py b/tools/tesh/tesh.py index 91084a9307..8e20c88cf7 100755 --- a/tools/tesh/tesh.py +++ b/tools/tesh/tesh.py @@ -327,6 +327,9 @@ class Cmd(object): global pgtokill try: + preexec_function = None + if not isWindows(): + preexec_function = lambda: os.setpgid(0, 0) proc = subprocess.Popen( args, bufsize=1, @@ -334,7 +337,7 @@ class Cmd(object): stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, - start_new_session=True) + preexec_fn=preexec_function) try: if not isWindows(): pgtokill = os.getpgid(proc.pid)