@@ -156,6 +156,14 @@ def kill_robot_process(path: str, process: subprocess.Popen) -> None:
156
156
pass
157
157
158
158
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
+
159
167
class AutorunProcessRegistry (object ):
160
168
TYPE_HANDLERS = {
161
169
USBType .ROBOT : open_run_robot_code_process ,
@@ -164,7 +172,7 @@ class AutorunProcessRegistry(object):
164
172
165
173
TYPE_CLOSE_HANDLER = {
166
174
USBType .ROBOT : kill_robot_process ,
167
- USBType .UPDATE : open_update_robot_process
175
+ USBType .UPDATE : noop_close
168
176
} # type: Dict[USBType, TypeCloseHandler]
169
177
170
178
def __init__ (self ) -> None :
@@ -208,8 +216,9 @@ class AutorunProcessRegistry(object):
208
216
def _detect_dead_mountpoint_path (self , path : str ) -> None :
209
217
LOGGER .info ("Lost mountpoint: %s" , path )
210
218
usb_type = self .mountpoint_types [path ]
219
+ process = self .mountpoint_processes [path ]
211
220
close_handler = self .TYPE_CLOSE_HANDLER [usb_type ]
212
- close_handler (path )
221
+ close_handler (path , process )
213
222
LOGGER .info (" -> closed process" )
214
223
del self .mountpoint_processes [path ]
215
224
del self .mountpoint_types [path ]
0 commit comments