Commit 68e6782c authored by Manuel Stoeckl's avatar Manuel Stoeckl

Use subprocess.Popen for startup failure test

According to the Python documentation, the new usage should be valid
for Python >=3.3, covering a wider range than the >=3.5 for
subprocess.Popen. Also, this change avoids a possible regression
with Python 3.8.0 in which the TimeoutExpired exception no longer
provides a non-None .output field.
parent 9f0b9f2e
Pipeline #83814 passed with stages
in 1 minute and 56 seconds
......@@ -53,23 +53,23 @@ def run_test(name, command, env, use_socketpair, expect_success):
pfds = []
timed_out = False
proc = subprocess.Popen(
command,
env=env,
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
pass_fds=pfds,
)
try:
proc = subprocess.run(
command,
env=env,
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
timeout=0.25,
pass_fds=pfds,
)
output, none = proc.communicate(timeout=0.25)
except subprocess.TimeoutExpired as e:
timed_out = True
output = e.output
# Program began to wait for a connection
proc.kill()
output, none = proc.communicate()
retcode = 0 if "client" in command else (0 if expect_success else 1)
timed_out = True
else:
output = proc.stdout
retcode = proc.returncode
if use_socketpair:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment