test_cli.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:dcos-tunnel 作者: dcos 项目源码 文件源码
def _tunnel(ttype, args):
    cli_test_ssh_key_path = os.environ['CLI_TEST_SSH_KEY_PATH']

    cmd = ('ssh-agent /bin/bash -c "ssh-add {0} 2> /dev/null && ' +
           '$(which dcos-tunnel) tunnel {1} {2}"'
           ).format(cli_test_ssh_key_path, ttype, ' '.join(args))

    pfn = None
    if sys.platform != 'win32':
        pfn = os.setsid

    cflag = 0
    if sys.platform == 'win32':
        cflag = subprocess.CREATE_NEW_PROCESS_GROUP

    print(cmd)
    return subprocess.Popen(shlex.split(cmd), preexec_fn=pfn,
                            creationflags=cflag, stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号