Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fishros committed Sep 8, 2024
1 parent 59a9928 commit e9736c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,14 +992,14 @@ def log_callback(log,log_type):

msg = 'code:{}'.format(code)
if code == 0: msg="success"
self.ret_code = code

if code==0:
self.bar.finsh('CMD Result:{}'.format(msg),'\033[37m')
else:
self.bar.finsh('CMD Result:{}'.format(msg),'\033[31m')


self.ret_code = code
self.ret_out = out
self.ret_err = err
self.ret_ok = True
Expand All @@ -1008,10 +1008,14 @@ def run_command(self,executable='/bin/sh'):
self.command_thread = threading.Thread(target=self.command_thread)
self.command_thread.start()
time.sleep(0.5) # 等待线程启动
while self.is_command_finish()==-1 and not self.ret_ok:
while self.is_command_finish()==-1:
self.bar.update_time()
time.sleep(0.1)

start_time = time.time()
while not self.ret_ok and time.time()-start_time < 2.0: # 2s timeout wait command_thread end
time.sleep(0.1)

Tracking.put_cmd_result(self.ret_code,self.ret_out,self.ret_err,self.command)
return (self.ret_code,self.ret_out,self.ret_err)

Expand Down

0 comments on commit e9736c0

Please sign in to comment.