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


Python forking.Popen方法代码示例

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


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

示例1: __init__

# 需要导入模块: from multiprocessing import forking [as 别名]
# 或者: from multiprocessing.forking import Popen [as 别名]
def __init__(self, *args, **kw):
      if hasattr(sys, 'frozen'):
        # We have to set original _MEIPASS2 value from sys._MEIPASS
        # to get --onefile mode working.
        os.putenv('_MEIPASS2', sys._MEIPASS)
      try:
        super(_Popen, self).__init__(*args, **kw)
      finally:
        if hasattr(sys, 'frozen'):
          # On some platforms (e.g. AIX) 'os.unsetenv()' is not
          # available. In those cases we cannot delete the variable
          # but only set it to the empty string. The bootloader
          # can handle this case.
          if hasattr(os, 'unsetenv'):
            os.unsetenv('_MEIPASS2')
          else:
            os.putenv('_MEIPASS2', '')

  # Second override 'Popen' class with our modified version. 
开发者ID:lanjelot,项目名称:patator,代码行数:21,代码来源:patator.py

示例2: execute

# 需要导入模块: from multiprocessing import forking [as 别名]
# 或者: from multiprocessing.forking import Popen [as 别名]
def execute(self, host, port='389', binddn='', bindpw='', basedn='', ssl='0'):
    uri = 'ldap%s://%s:%s' % ('s' if ssl != '0' else '', host, port)
    cmd = ['ldapsearch', '-H', uri, '-e', 'ppolicy', '-D', binddn, '-w', bindpw, '-b', basedn, '-s', 'one']
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env={'LDAPTLS_REQCERT': 'never'})
    out = p.stdout.read()
    err = p.stderr.read()

    with Timing() as timing:
      code = p.wait()

    mesg = repr((out + err).strip())[1:-1]
    trace = '[out]\n%s\n[err]\n%s' % (out, err)

    return self.Response(code, mesg, timing, trace)

# }}}

# SMB {{{ 
开发者ID:lanjelot,项目名称:patator,代码行数:20,代码来源:patator.py

示例3: __init__

# 需要导入模块: from multiprocessing import forking [as 别名]
# 或者: from multiprocessing.forking import Popen [as 别名]
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version. 
开发者ID:devgc,项目名称:EventMonkey,代码行数:21,代码来源:EventMonkey.py

示例4: __iter__

# 需要导入模块: from multiprocessing import forking [as 别名]
# 或者: from multiprocessing.forking import Popen [as 别名]
def __iter__(self):
    p = subprocess.Popen(self.prog.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    return p.stdout 
开发者ID:lanjelot,项目名称:patator,代码行数:5,代码来源:patator.py


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