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


Python Subprocess.wait_for_exit方法代码示例

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


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

示例1: test_sigchild_future

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
 def test_sigchild_future(self):
     Subprocess.initialize()
     self.addCleanup(Subprocess.uninitialize)
     subproc = Subprocess([sys.executable, "-c", "pass"])
     ret = yield subproc.wait_for_exit()
     self.assertEqual(ret, 0)
     self.assertEqual(subproc.returncode, ret)
开发者ID:bdarnell,项目名称:tornado,代码行数:9,代码来源:process_test.py

示例2: test_wait_for_exit_raise_disabled

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
 def test_wait_for_exit_raise_disabled(self):
     skip_if_twisted()
     Subprocess.initialize()
     self.addCleanup(Subprocess.uninitialize)
     subproc = Subprocess([sys.executable, '-c', 'import sys; sys.exit(1)'])
     ret = yield subproc.wait_for_exit(raise_error=False)
     self.assertEqual(ret, 1)
开发者ID:conn4575,项目名称:tornado,代码行数:9,代码来源:process_test.py

示例3: test_wait_for_exit_raise

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
 def test_wait_for_exit_raise(self):
     Subprocess.initialize()
     self.addCleanup(Subprocess.uninitialize)
     subproc = Subprocess([sys.executable, "-c", "import sys; sys.exit(1)"])
     with self.assertRaises(subprocess.CalledProcessError) as cm:
         yield subproc.wait_for_exit()
     self.assertEqual(cm.exception.returncode, 1)
开发者ID:bdarnell,项目名称:tornado,代码行数:9,代码来源:process_test.py

示例4: send_to_ruby

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
    async def send_to_ruby(self, request_json):
        env = {
            "PCSD_DEBUG": "true" if self.__debug else "false"
        }
        if self.__gem_home is not None:
            env["GEM_HOME"] = self.__gem_home

        if self.__no_proxy is not None:
            env["NO_PROXY"] = self.__no_proxy
        if self.__https_proxy is not None:
            env["HTTPS_PROXY"] = self.__https_proxy

        pcsd_ruby = Subprocess(
            [
                self.__ruby_executable, "-I",
                self.__pcsd_dir,
                self.__pcsd_cmdline_entry
            ],
            stdin=Subprocess.STREAM,
            stdout=Subprocess.STREAM,
            stderr=Subprocess.STREAM,
            env=env
        )
        await Task(pcsd_ruby.stdin.write, str.encode(request_json))
        pcsd_ruby.stdin.close()
        return await multi([
            Task(pcsd_ruby.stdout.read_until_close),
            Task(pcsd_ruby.stderr.read_until_close),
            pcsd_ruby.wait_for_exit(raise_error=False),
        ])
开发者ID:tomjelinek,项目名称:pcs,代码行数:32,代码来源:ruby_pcsd.py

示例5: test_h2spec

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
 def test_h2spec(self):
     h2spec_cmd = [self.h2spec_path, "-p",
                   str(self.get_http_port())]
     for section in options.h2spec_section:
         h2spec_cmd.extend(["-s", section])
     h2spec_proc = Subprocess(h2spec_cmd)
     yield h2spec_proc.wait_for_exit()
开发者ID:bdarnell,项目名称:tornado_http2,代码行数:9,代码来源:h2spec_test.py

示例6: test_sigchild_future

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
 def test_sigchild_future(self):
     skip_if_twisted()
     Subprocess.initialize()
     self.addCleanup(Subprocess.uninitialize)
     subproc = Subprocess([sys.executable, '-c', 'pass'])
     ret = yield subproc.wait_for_exit()
     self.assertEqual(ret, 0)
     self.assertEqual(subproc.returncode, ret)
开发者ID:conn4575,项目名称:tornado,代码行数:10,代码来源:process_test.py

示例7: work1

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
def work1():
    p = Subprocess(['sleep', '5'])
    future = p.wait_for_exit()

    ioloop.IOLoop.instance().add_future(future, finish_callback)
    print('work1: After add_future....')

    ioloop.IOLoop.instance().add_callback(dumy_callback)
    print ('work1: After add_callback...')
开发者ID:ideascf,项目名称:play,代码行数:11,代码来源:furture_play.py

示例8: _recognize_sample_with_gracenote

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
    def _recognize_sample_with_gracenote(self, sample_path):
        conf = self.settings['gn_config']
        proc = Subprocess([
            'tools/gracetune_identify.py',
            '--client-id', conf['client_id'],
            '--user-id', conf['user_id'],
            '--license', conf['license'],
            '--filename', sample_path
            ], stdout=Subprocess.STREAM)

        yield proc.wait_for_exit()
        ret = yield proc.stdout.read_until_close()
        raise Return(json.loads(ret))
开发者ID:quatrix,项目名称:listenin,代码行数:15,代码来源:upload_handler.py

示例9: run_command

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
def run_command(cmd, input=None, env=None):
    proc = Subprocess(cmd, shell=True, env=env, stdin=Subprocess.STREAM, stdout=Subprocess.STREAM)
    inbytes = None
    if input:
        inbytes = input.encode()
        yield proc.stdin.write(inbytes)
    proc.stdin.close()
    out = yield proc.stdout.read_until_close()
    proc.stdout.close()
    err = yield proc.wait_for_exit()
    if err != 0:
        return err # exit error?
    else:
        out = out.decode().strip()
        return out
开发者ID:anderbubble,项目名称:batchspawner,代码行数:17,代码来源:batchspawner.py

示例10: run_command

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
def run_command(cmd, input=None, env=None):
    proc = Subprocess(cmd, shell=True, env=env, stdin=Subprocess.STREAM, stdout=Subprocess.STREAM)
    inbytes = None
    if input:
        inbytes = input.encode()
        try:
            yield proc.stdin.write(inbytes)
        except StreamClosedError as exp:
            # Apparently harmless
            pass
    proc.stdin.close()
    out = yield proc.stdout.read_until_close()
    proc.stdout.close()
    err = yield proc.wait_for_exit()
    if err != 0:
        return err # exit error?
    else:
        out = out.decode().strip()
        return out
开发者ID:jupyterhub,项目名称:batchspawner,代码行数:21,代码来源:batchspawner.py

示例11: test_wait_for_exit_raise_disabled

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
 def test_wait_for_exit_raise_disabled(self):
     Subprocess.initialize()
     self.addCleanup(Subprocess.uninitialize)
     subproc = Subprocess([sys.executable, "-c", "import sys; sys.exit(1)"])
     ret = yield subproc.wait_for_exit(raise_error=False)
     self.assertEqual(ret, 1)
开发者ID:bdarnell,项目名称:tornado,代码行数:8,代码来源:process_test.py

示例12: work2

# 需要导入模块: from tornado.process import Subprocess [as 别名]
# 或者: from tornado.process.Subprocess import wait_for_exit [as 别名]
def work2():
    p = Subprocess(['sleep', '2'])
    print('work2: Before yield')
    ret = yield p.wait_for_exit()
    print('work2: After yield, result:', ret)
开发者ID:ideascf,项目名称:play,代码行数:7,代码来源:furture_play.py


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