Skip to content

Commit d89ce2e

Browse files
stinosdpgeorge
authored andcommitted
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.
1 parent 3dda964 commit d89ce2e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/run-tests

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,16 @@ def run_micropython(pyb, args, test_file, is_special=False):
103103
banner = get(True)
104104
output_mupy = banner + b''.join(send_get(line) for line in f)
105105
send_get(b'\x04') # exit the REPL, so coverage info is saved
106-
p.kill()
106+
# At this point the process might have exited already, but trying to
107+
# kill it 'again' normally doesn't result in exceptions as Python and/or
108+
# the OS seem to try to handle this nicely. When running Linux on WSL
109+
# though, the situation differs and calling Popen.kill after the process
110+
# terminated results in a ProcessLookupError. Just catch that one here
111+
# since we just want the process to be gone and that's the case.
112+
try:
113+
p.kill()
114+
except ProcessLookupError:
115+
pass
107116
os.close(master)
108117
os.close(slave)
109118
else:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy