parameters: (exec_name, args, logger)
return_statement: return proc.returncode, traces
docstring: Launch an exec with args, log the outputs
docstring_summary: Launch an exec with args, log the outputs
docstring_tokens: Launch an exec with args log the outputs
function: def launch_exec_traces(exec_name, args, logger):
      """ Launch an exec with args, log the outputs """
      hidden_args = hide_args(args, ["--cities-connection-string", "--connection-string"])
      log = 'Launching ' + exec_name + ' ' + ' '.join(hidden_args)
      # we hide the password in logs
      logger.info(re.sub('password=\w+', 'password=xxxxxxxxx', log))
  
      args.insert(0, exec_name)
  
      proc = subprocess.Popen(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
      traces = ""
      try:
          make_async(proc.stderr)
          make_async(proc.stdout)
          while True:
              select.select([proc.stdout, proc.stderr], [], [])
  
              for pipe in proc.stdout, proc.stderr:
                  log_pipe = read_async(pipe)
                  if log_pipe:
                      logs, line = parse_log(log_pipe.decode("utf-8"))
                      for l in logs:
                          logger.log(l.level, l.msg)
                          traces += "##  {}  ##".format(l.msg)
  
              if proc.poll() is not None:
                  break
      finally:
          proc.stdout.close()
          proc.stderr.close()
  
      return proc.returncode, traces
function_tokens: def launch_exec_traces ( exec_name , args , logger ) : hidden_args = hide_args ( args , [ "--cities-connection-string" , "--connection-string" ] ) log = 'Launching ' + exec_name + ' ' + ' ' . join ( hidden_args ) # we hide the password in logs logger . info ( re . sub ( 'password=\w+' , 'password=xxxxxxxxx' , log ) ) args . insert ( 0 , exec_name ) proc = subprocess . Popen ( args , stderr = subprocess . PIPE , stdout = subprocess . PIPE , close_fds = True ) traces = "" try : make_async ( proc . stderr ) make_async ( proc . stdout ) while True : select . select ( [ proc . stdout , proc . stderr ] , [ ] , [ ] ) for pipe in proc . stdout , proc . stderr : log_pipe = read_async ( pipe ) if log_pipe : logs , line = parse_log ( log_pipe . decode ( "utf-8" ) ) for l in logs : logger . log ( l . level , l . msg ) traces += "##  {}  ##" . format ( l . msg ) if proc . poll ( ) is not None : break finally : proc . stdout . close ( ) proc . stderr . close ( ) return proc . returncode , traces