Skip to content
Snippets Groups Projects
Commit d89ce2ed authored by stijn's avatar stijn Committed by Damien George
Browse files

tests/run-tests: Ignore exception in process kill when ending repl test.

When running Linux on WSL, Popen.kill() can raise a ProcessLookupError if
the process does not exist anymore, which can happen here since the
previous statement already tries to close the process by sending Ctrl-D to
the running repl.  This doesn't seem to be a problem on other OSes, so just
swallow the exception silently since it indicates the process has been
closed already, which after all is what we want.
parent 3dda9647
No related branches found
No related tags found
No related merge requests found
...@@ -103,7 +103,16 @@ def run_micropython(pyb, args, test_file, is_special=False): ...@@ -103,7 +103,16 @@ def run_micropython(pyb, args, test_file, is_special=False):
banner = get(True) banner = get(True)
output_mupy = banner + b''.join(send_get(line) for line in f) output_mupy = banner + b''.join(send_get(line) for line in f)
send_get(b'\x04') # exit the REPL, so coverage info is saved send_get(b'\x04') # exit the REPL, so coverage info is saved
# At this point the process might have exited already, but trying to
# kill it 'again' normally doesn't result in exceptions as Python and/or
# the OS seem to try to handle this nicely. When running Linux on WSL
# though, the situation differs and calling Popen.kill after the process
# terminated results in a ProcessLookupError. Just catch that one here
# since we just want the process to be gone and that's the case.
try:
p.kill() p.kill()
except ProcessLookupError:
pass
os.close(master) os.close(master)
os.close(slave) os.close(slave)
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment