Skip to content

Commit 68d01c5

Browse files
committed
Merge branch 'master' into add-typing
2 parents 81c8e3d + 0da6990 commit 68d01c5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

runusb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ def kill_robot_process(path: str, process: subprocess.Popen) -> None:
156156
pass
157157

158158

159+
def noop_close(path, process):
160+
"""
161+
We don't actually want to kill in the case of the update process.
162+
Could lead to the robot in a broken state!
163+
"""
164+
pass
165+
166+
159167
class AutorunProcessRegistry(object):
160168
TYPE_HANDLERS = {
161169
USBType.ROBOT: open_run_robot_code_process,
@@ -164,7 +172,7 @@ class AutorunProcessRegistry(object):
164172

165173
TYPE_CLOSE_HANDLER = {
166174
USBType.ROBOT: kill_robot_process,
167-
USBType.UPDATE: open_update_robot_process
175+
USBType.UPDATE: noop_close
168176
} # type: Dict[USBType, TypeCloseHandler]
169177

170178
def __init__(self) -> None:
@@ -208,8 +216,9 @@ class AutorunProcessRegistry(object):
208216
def _detect_dead_mountpoint_path(self, path: str) -> None:
209217
LOGGER.info("Lost mountpoint: %s", path)
210218
usb_type = self.mountpoint_types[path]
219+
process = self.mountpoint_processes[path]
211220
close_handler = self.TYPE_CLOSE_HANDLER[usb_type]
212-
close_handler(path)
221+
close_handler(path, process)
213222
LOGGER.info(" -> closed process")
214223
del self.mountpoint_processes[path]
215224
del self.mountpoint_types[path]

0 commit comments

Comments
 (0)