Skip to content

Commit 32491e6

Browse files
authored
Catch NoSuchProcess error if process was killed early
1 parent 8014189 commit 32491e6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

reference_system/reference_system_py/benchmark.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ def terminatingRos2Run(pkg, executable, rmw, env=os.environ, args=[], **kwargs):
9696
# The process returned by subprocess.Popen is the shell process, not the
9797
# ROS process. Terminating the former will not necessarily terminate the latter.
9898
# Terminate all the *children* of the shell process instead.
99-
children = shellproc.children()
99+
try:
100+
children = shellproc.children()
101+
except psutil.NoSuchProcess:
102+
children = []
103+
100104
assert len(children) <= 1
101105
if children:
102106
rosproc = children[0]

0 commit comments

Comments
 (0)