code: def exec_cmd(cmd, role, taskid, pass_env):
      
      if cmd[0].find('/') == -1 and os.path.exists(cmd[0]) and os.name != 'nt':
          cmd[0] = './' + cmd[0]
      cmd = ' '.join(cmd)
      env = os.environ.copy()
      for k, v in pass_env.items():
          env[k] = str(v)
  
      env['DMLC_TASK_ID'] = str(taskid)
      env['DMLC_ROLE'] = role
      env['DMLC_JOB_CLUSTER'] = 'local'
  
      ntrial = 0
      while True:
          if os.name == 'nt':
              env['DMLC_NUM_ATTEMPT'] = str(ntrial)
              ret = subprocess.call(cmd, shell=True, env=env)
              if ret != 0:
                  ntrial += 1
                  continue
          else:
              bash = cmd
              ret = subprocess.call(bash, shell=True, executable='bash', env=env)
          if ret == 0:
              logging.debug('Thread %d exit with 0', taskid)
              return
          else:
              if os.name == 'nt':
                  sys.exit(-1)
              else:
                  raise RuntimeError('Get nonzero return code=%d' % ret)
docs: Execute the command line command.