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


Python popen2.popen2方法代码示例

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


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

示例1: setUp

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def setUp(self):
        popen2._cleanup()
        # When the test runs, there shouldn't be any open pipes
        self.assertFalse(popen2._active, "Active pipes when test starts" +
            repr([c.cmd for c in popen2._active])) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:test_popen2.py

示例2: tearDown

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def tearDown(self):
        for inst in popen2._active:
            inst.wait()
        popen2._cleanup()
        self.assertFalse(popen2._active, "popen2._active not empty")
        # The os.popen*() API delegates to the subprocess module (on Unix)
        import subprocess
        for inst in subprocess._active:
            inst.wait()
        subprocess._cleanup()
        self.assertFalse(subprocess._active, "subprocess._active not empty")
        reap_children() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:14,代码来源:test_popen2.py

示例3: test_popen2

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def test_popen2(self):
        r, w = popen2.popen2(self.cmd)
        self.validate_output(self.teststr, self.expected, r, w) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_popen2.py

示例4: test_popen3

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def test_popen3(self):
        if os.name == 'posix':
            r, w, e = popen2.popen3([self.cmd])
            self.validate_output(self.teststr, self.expected, r, w, e)

        r, w, e = popen2.popen3(self.cmd)
        self.validate_output(self.teststr, self.expected, r, w, e) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_popen2.py

示例5: test_os_popen2

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def test_os_popen2(self):
        # same test as test_popen2(), but using the os.popen*() API
        if os.name == 'posix':
            w, r = os.popen2([self.cmd])
            self.validate_output(self.teststr, self.expected, r, w)

            w, r = os.popen2(["echo", self.teststr])
            got = r.read()
            self.assertEqual(got, self.teststr + "\n")

        w, r = os.popen2(self.cmd)
        self.validate_output(self.teststr, self.expected, r, w) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:14,代码来源:test_popen2.py

示例6: _apply_ossl_cmd

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def _apply_ossl_cmd(self, osslcmd, rawdata):
        r,w=popen2.popen2(osslcmd)
        w.write(rawdata)
        w.close()
        res = r.read()
        r.close()
        return res 
开发者ID:medbenali,项目名称:CyberScan,代码行数:9,代码来源:cert.py

示例7: print_chain

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def print_chain(l):
    llen = len(l) - 1
    if llen < 0:
        return ""
    c = l[llen]
    llen -= 1
    s = "_ "
    if not c.isSelfSigned():
        s = "_ ... [Missing Root]\n"
    else:
        s += "%s [Self Signed]\n" % c.subject
    i = 1
    while (llen != -1):
        c = l[llen]
        s += "%s\_ %s" % (" "*i, c.subject)
        if llen != 0:
            s += "\n"
        i += 2
        llen -= 1
    print s

# import popen2
# a=popen2.Popen3("openssl crl -text -inform DER -noout ", capturestderr=True)
# a.tochild.write(open("samples/klasa1.crl").read())
# a.tochild.close()
# a.poll() 
开发者ID:medbenali,项目名称:CyberScan,代码行数:28,代码来源:cert.py

示例8: resolve_clang_includes

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def resolve_clang_includes(self):
    cmd = "clang -print-file-name=include"
    rfd, wfd = popen2.popen2(cmd)
    return rfd.read().strip("\n") 
开发者ID:joxeankoret,项目名称:pigaios,代码行数:6,代码来源:srcbindiff.py

示例9: _apply_ossl_cmd

# 需要导入模块: import popen2 [as 别名]
# 或者: from popen2 import popen2 [as 别名]
def _apply_ossl_cmd(self, osslcmd, rawdata):
	r,w=popen2.popen2(osslcmd)
	w.write(rawdata)
	w.close()
	res = r.read()
	r.close()
	return res 
开发者ID:RiskSense-Ops,项目名称:CVE-2016-6366,代码行数:9,代码来源:cert.py


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