@@ -279,12 +279,6 @@ def run(self,commands):
279279 finally :
280280 self .stop_qemu ()
281281
282- def run_command (command , timeout = None ):
283- """运行命令并返回输出和结果"""
284- print (command )
285- result = subprocess .run (command , shell = True , capture_output = True , text = True , timeout = timeout )
286- return result .stdout , result .returncode
287-
288282def check_output (output , check_string ):
289283 """检查输出中是否包含指定字符串"""
290284 flag = check_string in output
@@ -421,23 +415,23 @@ def check_output(output, check_string):
421415 #执行编译前的命令
422416 if pre_build_commands is not None :
423417 for command in pre_build_commands :
424- output , returncode = run_command (command )
418+ output , returncode = run_cmd (command , output_info = False )
425419 print (output )
426420 if returncode != 0 :
427421 print (f"Pre-build command failed: { command } " )
428422 print (output )
429423 #执行编译命令
430424 if build_command is not None :
431425 for command in build_command :
432- output , returncode = run_command (command )
426+ output , returncode = run_cmd (command , output_info = False )
433427 print (output )
434428 if returncode != 0 or not check_output (output , build_check_result ):
435429 print (f"build command failed: { command } " )
436430 print (output )
437431 #执行编译后的命令
438432 if post_build_command is not None :
439433 for command in post_build_command :
440- output , returncode = run_command (command )
434+ output , returncode = run_cmd (command , output_info = False )
441435 print (output )
442436 if returncode != 0 :
443437 print (f"Post-build command failed: { command } " )
0 commit comments