Changeset: 664f1eafc2ec for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/664f1eafc2ec
Modified Files:
testing/Mtest.py.in
testing/process.py
Branch: Mar2025
Log Message:
Fix the hoops we had to jump through on Windows to terminate the server.
See changeset e9aefb4fc944 for the original hoops.
diffs (51 lines):
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2662,7 +2662,8 @@ class ServerClass:
stdout = process.PIPE
if os.name == 'nt':
proc = process.Popen(cmd, stdin=stdin, stdout=stdout,
- stderr=stderr, text=True, cwd=cwd, env=env)
+ stderr=stderr, text=True, cwd=cwd, env=env,
+
creationflags=process.CREATE_NEW_PROCESS_GROUP)
else:
proc = process.Popen(cmd, stdin=stdin, stdout=stdout,
stderr=stderr, text=True, cwd=cwd, env=env)
diff --git a/testing/process.py b/testing/process.py
--- a/testing/process.py
+++ b/testing/process.py
@@ -26,6 +26,13 @@ try:
except ImportError:
DEVNULL = os.open(os.devnull, os.O_RDWR)
__all__ = ['PIPE', 'DEVNULL', 'Popen', 'client', 'server', 'TimeoutExpired']
+try:
+ # only on Windows:
+ from subprocess import CREATE_NEW_PROCESS_GROUP
+except ImportError:
+ pass
+else:
+ __all__.append('CREATE_NEW_PROCESS_GROUP')
verbose = False
@@ -562,6 +569,10 @@ class server(Popen):
os.unlink(started)
except OSError:
pass
+ if os.name == 'nt':
+ kw = {'creationflags': CREATE_NEW_PROCESS_GROUP}
+ else:
+ kw = {}
starttime = time.time()
super().__init__(cmd + args,
stdin=stdin,
@@ -570,7 +581,8 @@ class server(Popen):
shell=False,
text=True,
bufsize=bufsize,
- encoding='utf-8')
+ encoding='utf-8',
+ **kw)
self.isserver = True
if stderr == PIPE:
self.stderr = _BufferedPipe(self.stderr)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]