File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -338,15 +338,15 @@ def _execute_commands_in_subprocess(commands: List[str]) -> None:
338
338
Executes the given commands in a subprocess and asserts that it was successful.
339
339
"""
340
340
import subprocess
341
- process = subprocess .Popen (
341
+ with subprocess .Popen (
342
342
commands ,
343
343
stdout = subprocess .PIPE ,
344
344
stderr = subprocess .PIPE ,
345
- text = True
346
- )
347
- stdout , stderr = process .communicate ()
348
- if process .returncode != 0 :
349
- raise Exception (f'error executing command ({ process .returncode } ): { stderr } ' )
345
+ text = True ,
346
+ ) as process :
347
+ stdout , stderr = process .communicate ()
348
+ if process .returncode != 0 :
349
+ raise Exception (f'error executing command ({ process .returncode } ): { stderr } ' )
350
350
351
351
def _write_key_to_root_file_linux (self , key_hex : str ) -> None :
352
352
"""
You can’t perform that action at this time.
0 commit comments