当前位置: 首页>>代码示例>>Python>>正文


Python Popen.args方法代码示例

本文整理汇总了Python中subprocess.Popen.args方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.args方法的具体用法?Python Popen.args怎么用?Python Popen.args使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subprocess.Popen的用法示例。


在下文中一共展示了Popen.args方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_bg

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run_bg(cmd, **kargs):
    if options.verbose:
        print "run:", cmd, ", ".join("%s=%s" % x for x in kargs.iteritems())
    if isinstance(cmd, str):
        args = shlex.split(cmd)
    else:
        args = cmd
    proc = Popen(args=args, **kargs)
    proc.args = args
    _add_proc(proc)
    return proc
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:13,代码来源:utils.py

示例2: run_bg

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run_bg(cmd, **kargs):
  if options.verbose == 2:
    logging.debug("run: %s %s", cmd, ', '.join('%s=%s' % x for x in kargs.iteritems()))
  if isinstance(cmd, str):
    args = shlex.split(cmd)
  else:
    args = cmd
  proc = Popen(args=args, **kargs)
  proc.args = args
  _add_proc(proc)
  return proc
开发者ID:krast,项目名称:vitess,代码行数:13,代码来源:utils.py

示例3: execute

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def execute(cmd, trap_output=False, verbose=False, **kargs):
  args = shlex.split(cmd)
  if trap_output:
    kargs['stdout'] = PIPE
    kargs['stderr'] = PIPE
  if verbose:
    print "Execute:", cmd, ', '.join('%s=%s' % x for x in kargs.iteritems())
  proc = Popen(args, **kargs)
  proc.args = args
  stdout, stderr = proc.communicate()
  if proc.returncode:
    raise Exception('FAIL: %s %s %s' % (args, stdout, stderr))
  return stdout, stderr
开发者ID:Carney,项目名称:vitess,代码行数:15,代码来源:framework.py

示例4: run_bg

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run_bg(cmd, **kargs):
  if options.verbose == 2:
    logging.debug("run: %s %s", cmd, ', '.join('%s=%s' % x for x in kargs.iteritems()))
  if 'extra_env' in kargs and kargs['extra_env']:
    kargs['env'] = os.environ.copy()
    kargs['env'].update(kargs['extra_env'])
    del(kargs['extra_env'])
  if isinstance(cmd, str):
    args = shlex.split(cmd)
  else:
    args = cmd
  proc = Popen(args=args, **kargs)
  proc.args = args
  _add_proc(proc)
  return proc
开发者ID:waderly,项目名称:vitess,代码行数:17,代码来源:utils.py

示例5: run_fail

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run_fail(cmd, **kargs):
  if isinstance(cmd, str):
    args = shlex.split(cmd)
  else:
    args = cmd
  kargs['stdout'] = PIPE
  kargs['stderr'] = PIPE
  if options.verbose == 2:
    logging.debug("run: (expect fail) %s %s", cmd, ', '.join('%s=%s' % x for x in kargs.iteritems()))
  proc = Popen(args, **kargs)
  proc.args = args
  stdout, stderr = proc.communicate()
  if proc.returncode == 0:
    logging.info("stdout:\n%sstderr:\n%s", stdout, stderr)
    raise TestError('expected fail:', args, stdout, stderr)
  return stdout, stderr
开发者ID:krast,项目名称:vitess,代码行数:18,代码来源:utils.py

示例6: run_fail

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run_fail(cmd, **kargs):
    if isinstance(cmd, str):
        args = shlex.split(cmd)
    else:
        args = cmd
    kargs["stdout"] = PIPE
    kargs["stderr"] = PIPE
    if options.verbose:
        print "run: (expect fail)", cmd, ", ".join("%s=%s" % x for x in kargs.iteritems())
    proc = Popen(args, **kargs)
    proc.args = args
    stdout, stderr = proc.communicate()
    if proc.returncode == 0:
        debug("stdout:\n" + stdout + "stderr:\n" + stderr)
        raise TestError("expected fail:", args, stdout, stderr)
    return stdout, stderr
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:18,代码来源:utils.py

示例7: run_bg

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run_bg(cmd, **kargs):
    if options.verbose == 2:
        logging.debug("run: %s %s", cmd, ", ".join("%s=%s" % x for x in kargs.iteritems()))
    if "extra_env" in kargs:
        kargs["env"] = os.environ.copy()
        if kargs["extra_env"]:
            kargs["env"].update(kargs["extra_env"])
        del (kargs["extra_env"])
    if isinstance(cmd, str):
        args = shlex.split(cmd)
    else:
        args = cmd
    proc = Popen(args=args, **kargs)
    proc.args = args
    _add_proc(proc)
    return proc
开发者ID:springlee,项目名称:vitess,代码行数:18,代码来源:utils.py

示例8: run

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run(cmd, trap_output=False, raise_on_error=True, **kargs):
  if isinstance(cmd, str):
    args = shlex.split(cmd)
  else:
    args = cmd
  if trap_output:
    kargs['stdout'] = PIPE
    kargs['stderr'] = PIPE
  logging.debug("run: %s %s", str(cmd), ', '.join('%s=%s' % x for x in kargs.iteritems()))
  proc = Popen(args, **kargs)
  proc.args = args
  stdout, stderr = proc.communicate()
  if proc.returncode:
    if raise_on_error:
      raise TestError('cmd fail:', args, stdout, stderr)
    else:
      logging.debug('cmd fail: %s %s %s', str(args), stdout, stderr)
  return stdout, stderr
开发者ID:krast,项目名称:vitess,代码行数:20,代码来源:utils.py

示例9: run

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run(cmd, trap_output=False, raise_on_error=True, **kargs):
    if isinstance(cmd, str):
        args = shlex.split(cmd)
    else:
        args = cmd
    if trap_output:
        kargs["stdout"] = PIPE
        kargs["stderr"] = PIPE
    logging.debug("run: %s %s", str(cmd), ", ".join("%s=%s" % x for x in kargs.iteritems()))
    proc = Popen(args, **kargs)
    proc.args = args
    stdout, stderr = proc.communicate()
    if proc.returncode:
        if raise_on_error:
            pause("cmd fail: %s, pausing..." % (args))
            raise TestError("cmd fail:", args, proc.returncode, stdout, stderr)
        else:
            logging.debug("cmd fail: %s %d %s %s", str(args), proc.returncode, stdout, stderr)
    return stdout, stderr
开发者ID:springlee,项目名称:vitess,代码行数:21,代码来源:utils.py

示例10: run

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def run(cmd, trap_output=False, raise_on_error=True, **kargs):
    if isinstance(cmd, str):
        args = shlex.split(cmd)
    else:
        args = cmd
    if trap_output:
        kargs["stdout"] = PIPE
        kargs["stderr"] = PIPE
    if options.verbose:
        print "run:", cmd, ", ".join("%s=%s" % x for x in kargs.iteritems())
    proc = Popen(args, **kargs)
    proc.args = args
    stdout, stderr = proc.communicate()
    if proc.returncode:
        if raise_on_error:
            raise TestError("cmd fail:", args, stdout, stderr)
        else:
            if options.verbose:
                print "cmd fail:", args, stdout, stderr
    return stdout, stderr
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:22,代码来源:utils.py

示例11: background

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import args [as 别名]
def background(*args):
    """Run executable in the backround, return the popen"""
    p = Popen(cmdline(*args), stdout=PIPE, stderr=sys.stderr)
    p.args = args               # Save arguments for debugging output
    return p
开发者ID:b-cuts,项目名称:qpid-proton,代码行数:7,代码来源:example_test.py


注:本文中的subprocess.Popen.args方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。