def join_bg_jobs(bg_jobs, timeout=None):
 (ret, timeout_error) = (0, False)
 for bg_job in bg_jobs:
  bg_job.output_prepare(StringIO.StringIO(), StringIO.StringIO())
 try:
  start_time = time.time()
  timeout_error = _wait_for_commands(bg_jobs, start_time, timeout)
  for bg_job in bg_jobs:
   bg_job.process_output(stdout=True, final_read=True)
   bg_job.process_output(stdout=False, final_read=True)
 finally:
  for bg_job in bg_jobs:
   bg_job.cleanup()
 if timeout_error:
  raise error.CmdError(bg_jobs[0].command, bg_jobs[0].result, ('Command(s) did not complete within %d seconds' % timeout))
 return bg_jobs

def join_bg_jobs ( bg_jobs , timeout = None ) : ( ret , timeout_error ) = ( 0 , False ) for bg_job in bg_jobs : bg_job . output_prepare ( StringIO . StringIO ( ) , StringIO . StringIO ( ) ) try : start_time = time . time ( ) timeout_error = _wait_for_commands ( bg_jobs , start_time , timeout ) for bg_job in bg_jobs : bg_job . process_output ( stdout = True , final_read = True ) bg_job . process_output ( stdout = False , final_read = True ) finally : for bg_job in bg_jobs : bg_job . cleanup ( ) if timeout_error : raise error . CmdError ( bg_jobs [ 0 ] . command , bg_jobs [ 0 ] . result , ( 'Command(s) did not complete within %d seconds' % timeout ) ) return bg_jobs
joins the bg_jobs with the current thread .