當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。