コード例 #1
0
def _RunGsutilCommand(command_name, command_args, run_concurrent=False):
    """Runs the specified gsutil command and returns the command's exit code.

  Args:
    command_name: The gsutil command to run.
    command_args: List of arguments to pass to the command.
    run_concurrent: Whether concurrent uploads should be enabled while running
      the command.

  Returns:
    The exit code of the call to the gsutil command.
  """
    gsutil_path = _GetGsutilPath()

    gsutil_args = []
    if run_concurrent:
        gsutil_args += ['-m']
    gsutil_args += [command_name]
    gsutil_args += command_args
    env = None

    gsutil_cmd = execution_utils.ArgsForBinaryTool(gsutil_path, *gsutil_args)
    log.debug('Running command: [{args}], Env: [{env}]'.format(
        args=' '.join(gsutil_cmd), env=env))
    return execution_utils.Exec(gsutil_cmd, no_exit=True, env=env)
コード例 #2
0
def _RunGsutilCommand(gsutil_args):
    """Run a gsutil command.

  Args:
    gsutil_args: The list of arguments to pass to gsutil.

  Returns:
    The exit code of the call to the gsutil command.
  """
    args = execution_utils.ArgsForBinaryTool(_GetGsutilPath(), *gsutil_args)
    return execution_utils.Exec(args, no_exit=True)