@@ -81,14 +81,20 @@ def execute_command(
8181
8282 # Execute locally
8383 if popen :
84- return subprocess .Popen (
85- cmd ,
86- shell = True ,
87- cwd = cmd_dir ,
88- stdout = subprocess .PIPE ,
89- stderr = subprocess .PIPE ,
90- text = True ,
91- )
84+ try :
85+ return subprocess .Popen (
86+ cmd ,
87+ shell = True ,
88+ cwd = cmd_dir ,
89+ stdout = subprocess .PIPE ,
90+ stderr = subprocess .PIPE ,
91+ text = True ,
92+ )
93+ except OSError as e :
94+ if ignore_errors :
95+ print (f"Warning: failed to launch '{ cmd } ' in { cmd_dir !r} : { e } " )
96+ return None
97+ raise
9298 else :
9399 try :
94100 result = subprocess .run (
@@ -100,7 +106,7 @@ def execute_command(
100106 check = not ignore_errors ,
101107 )
102108 return result
103- except subprocess .CalledProcessError as e :
109+ except ( subprocess .CalledProcessError , OSError ) as e :
104110 if ignore_errors :
105111 return e
106112 raise
@@ -114,6 +120,7 @@ def execute_command_parallel(
114120 popen : bool = True ,
115121 redirect : bool = False ,
116122 wait : bool = True ,
123+ ignore_errors : bool = False ,
117124 ) -> List [subprocess .Popen ]:
118125 """
119126 Execute a command in parallel locally.
@@ -129,6 +136,7 @@ def execute_command_parallel(
129136 popen: Must be True for parallel execution
130137 redirect: Whether to redirect output to /dev/null
131138 wait: Whether to wait for all commands to complete
139+ ignore_errors: Whether to ignore command execution errors
132140
133141 Returns:
134142 List containing single Popen object
@@ -144,6 +152,7 @@ def execute_command_parallel(
144152 cmd_dir = cmd_dir ,
145153 nohup = nohup ,
146154 popen = True , # Always return Popen for parallel
155+ ignore_errors = ignore_errors ,
147156 )
148157
149158 processes = [process ]
0 commit comments