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


Python subprocess32.STDOUT属性代码示例

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


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

示例1: parent_identical_or_crashes

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def parent_identical_or_crashes(self, crash, parent):

        # Base names
        cbasename = os.path.basename(crash)
        pbasename = os.path.basename(parent)

        ## Filter queue filenames with sig info
        if self.find_crash_parent_regex.match(pbasename):
            self.logr("Parent ({}) looks like crashing input!".format(pbasename))
            return True

        try:
            diff_out = subprocess.check_output("diff -q {} {}".format(crash, parent),
                                               stderr=subprocess.STDOUT, shell=True)
        except Exception, e:
            diff_out = e.output 
开发者ID:test-pipeline,项目名称:orthrus,代码行数:18,代码来源:afl_sancov.py

示例2: fastq_bwa_mem_piped

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def fastq_bwa_mem_piped(fastqs,i,j,t,rg,out_dir,ref_path):
    output = ''
    bam = out_dir+'/'+fastqs[0].rsplit('/')[-1].rsplit('.fq')[0].rsplit('_')[0]+'.%s.bam'%j
    piped_mem = [bwa_mem,'-M','-t %s'%t,'-R',r"'%s'"%rg,ref_path,
                 '<(%s -f %s -i %s -j %s)'%(route,fastqs[0],i,j),
                 '<(%s -f %s -i %s -j %s)'%(route,fastqs[1],i,j),
                 '|',samtools_view,'-Sb','-','-@ %s'%t,
                 '|',sambamba_sort,'-t %s'%t,'--tmpdir=%s/temp'%out_dir,'-o',bam,'/dev/stdin']  #-@ for threads here
    try:#bwa mem call here-------------------------------------------
        output += subprocess.check_output(' '.join(piped_mem),
                                          stderr=subprocess.STDOUT,
                                          executable='/bin/bash',
                                          shell=True)
        output += subprocess.check_output(['rm','-rf','%s/temp'%out_dir])
    except Exception as E:
        output += str(E) #error on the call-------------------------
    return bam #list of bam files to merge into next step

    
#|| by number of fastq files presented 
开发者ID:TheJacksonLaboratory,项目名称:SVE,代码行数:22,代码来源:bwa_split.py

示例3: CheckRG

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def CheckRG(samtools,bam,out_name,result):
    file = out_name+'.bam.header'
    command = [samtools,'view','-SH',bam,'-o',file]
    print (' '.join(command))
    subprocess.check_output(' '.join(command),stderr=subprocess.STDOUT,shell=True)

    result=[]

    with open(file,'r') as f:
        header = f.readlines()
    for l in range(len(header)):
        i = 0
        if header[l][0:3] == "@RG":
          RG = {x.split(':')[0]:x.split(':')[-1].replace('\n','') for x in header[l].split('@RG')[-1].split('\t')[1:]}
          result.append(RG)

    clean = ['rm','-f',file]
    subprocess.check_output(' '.join(clean),stderr=subprocess.STDOUT,shell=True)
    return result 
开发者ID:TheJacksonLaboratory,项目名称:SVE,代码行数:21,代码来源:CheckGenerateRG.py

示例4: test_should_trigger_on_connect_if_client_connect_valid

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def test_should_trigger_on_connect_if_client_connect_valid(server_with_mocks):
    node_script = '''
        module.paths.push('{0}')
        WebSocket = require('ws')
        const SubscriptionClient =
        require('subscriptions-transport-ws').SubscriptionClient
        new SubscriptionClient('ws://localhost:{1}/socket')
    '''.format(
        os.path.join(os.path.dirname(__file__), 'node_modules'), TEST_PORT)
    try:
        subprocess.check_output(
            ['node', '-e', node_script], stderr=subprocess.STDOUT, timeout=.2)
    except:
        mock = server_with_mocks.get_nowait()
        assert mock.name == 'on_connect'
        mock.assert_called_once() 
开发者ID:hballard,项目名称:graphql-python-subscriptions,代码行数:18,代码来源:test_subscription_transport.py

示例5: test_should_trigger_on_connect_with_correct_cxn_params

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def test_should_trigger_on_connect_with_correct_cxn_params(server_with_mocks):
    node_script = '''
        module.paths.push('{0}')
        WebSocket = require('ws')
        const SubscriptionClient =
        require('subscriptions-transport-ws').SubscriptionClient
        const connectionParams = {{test: true}}
        new SubscriptionClient('ws://localhost:{1}/socket', {{
        connectionParams,
        }})
    '''.format(
        os.path.join(os.path.dirname(__file__), 'node_modules'), TEST_PORT)
    try:
        subprocess.check_output(
            ['node', '-e', node_script], stderr=subprocess.STDOUT, timeout=.2)
    except:
        mock = server_with_mocks.get_nowait()
        assert mock.name == 'on_connect'
        mock.assert_called_once()
        mock.assert_called_with({'test': True}) 
开发者ID:hballard,项目名称:graphql-python-subscriptions,代码行数:22,代码来源:test_subscription_transport.py

示例6: open_process

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def open_process(command, cwd=None, shell=True, _popen_lock=threading.Lock()):
    kwargs = {
        "shell": shell,
        "stdout": subprocess.PIPE,
        "stderr": subprocess.STDOUT,
        "stdin": subprocess.PIPE,
        "bufsize": 1,  # Line buffered
        "universal_newlines": True,
    }

    if cwd is not None:
        kwargs["cwd"] = cwd

    # Prevent signal propagation from parent process
    try:
        # Windows
        kwargs["creationflags"] = subprocess.CREATE_NEW_PROCESS_GROUP
    except AttributeError:
        # Unix
        kwargs["preexec_fn"] = os.setpgrp

    with _popen_lock:  # Work around Python 2 Popen race condition
        return subprocess.Popen(command, **kwargs) 
开发者ID:niklasf,项目名称:fishnet,代码行数:25,代码来源:fishnet.py

示例7: run_cmd

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def run_cmd(cmd):
    out = []

    fh = NamedTemporaryFile(delete=False)
    es = subprocess.call(cmd, stdin=None,
            stdout=fh, stderr=subprocess.STDOUT, shell=True)
    fh.close()
    with open(fh.name, 'r') as f:
        for line in f:
            out.append(line.rstrip('\n'))
    os.unlink(fh.name)

    if (es != 0):
        print "[-] Non-zero exit status '%d' for CMD: '%s'" % (es, cmd)
        for line in out:
            print line

    return es, out 
开发者ID:mrash,项目名称:Wireguard-macOS-LinuxVM,代码行数:20,代码来源:wg-routes.py

示例8: run_cmd_noout

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def run_cmd_noout(cmd_data):
    cmd = cmd_data[0]
    output = cmd_data[1]
    c = cmd[:-1]
    timeout = cmd[-1]
    display("Executing command: %s" % " ".join(c))

    current_time = time.time()
    f = open(output, 'w')
    if timeout:
        
        process = Popen(c, stdout=f, stderr=STDOUT)
        while time.time() < current_time + timeout and process.poll() is None:
            time.sleep(5)
        if process.poll() is None:

            display_error(
                "Timeout of %s reached. Aborting thread for command: %s"
                % (timeout, " ".join(c))
            )
            process.terminate()

    else:
        Popen(c, stdout=f, stderr=STDOUT).wait()
    f.close()
    return cmd_data 
开发者ID:depthsecurity,项目名称:armory,代码行数:28,代码来源:ModuleTemplate.py

示例9: subproc_call

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def subproc_call(cmd, timeout=None):
    try:
        output = subprocess.check_output(
                cmd, stderr=subprocess.STDOUT,
                shell=True, timeout=timeout)
        return output
    except subprocess.TimeoutExpired as e:
        logger.warn("Command timeout!")
        logger.warn(e.output)
    except subprocess.CalledProcessError as e:
        logger.warn("Commnad failed: {}".format(e.returncode))
        logger.warn(e.output) 
开发者ID:anonymous-author1,项目名称:DDRL,代码行数:14,代码来源:concurrency.py

示例10: run_proc_with_quit

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def run_proc_with_quit(proc_id, quit_dict, args, logfile=None, append=False, env=None, cwd=None):
    if logfile is None:
        logfile = os.devnull

    mode = 'ab' if append else 'wb'
    with open(logfile, mode) as logf:
        if proc_id in quit_dict:
            return None
        proc = subprocess.Popen(args, stdout=logf, stderr=subprocess.STDOUT,
                                env=env, cwd=cwd)
        retcode = None
        num_kill = 0
        timeout = 0.05
        while retcode is None and num_kill <= 2:
            try:
                retcode = proc.wait(timeout=timeout)
            except subprocess.TimeoutExpired:
                if proc_id in quit_dict:
                    if num_kill == 0:
                        proc.terminate()
                        timeout = quit_dict[proc_id]
                    elif num_kill == 1:
                        proc.kill()
                    num_kill += 1

        return proc.returncode 
开发者ID:ucb-art,项目名称:BAG_framework,代码行数:28,代码来源:process.py

示例11: start

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def start(self, args):
    cmd = self._get_cmd(args)
    self.proc = subprocess.Popen(cmd, stderr=subprocess.STDOUT, 
                                 stdout=subprocess.PIPE, preexec_fn=os.setsid,
                                 shell=self.shell)
    try:
      args = self._ready() 
      self.msg_ready(args)
    except ProcessException, e:
      # Ignore errors if process is being killed
      if not self.killing:
        self._set_error(str(e)) 
开发者ID:blissland,项目名称:blissflixx,代码行数:14,代码来源:processpipe.py

示例12: subproc_call

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def subproc_call(cmd, timeout=None):
    """Execute a command with timeout, and return both STDOUT/STDERR.

    Args:
        cmd (str): the command to execute.
        timeout (float): timeout in seconds.

    Returns:
        output (bytes), retcode(int): If timeout, retcode is -1.

    """
    try:
        output = subprocess.check_output(
            cmd, stderr=subprocess.STDOUT,
            shell=True, timeout=timeout)
        return output, 0
    except subprocess.TimeoutExpired as e:
        print("Command '{}' timeout!".format(cmd))
        print(e.output.decode('utf-8'))
        return e.output, -1
    except subprocess.CalledProcessError as e:
        print("Command '{}' failed, return code={}".format(cmd, e.returncode))
        print(e.output.decode('utf-8'))
        return e.output, e.returncode
    except Exception:
        print("Command '{}' failed to run.".format(cmd))
        return "", -2 
开发者ID:blue-oil,项目名称:blueoil,代码行数:29,代码来源:tune_ray.py

示例13: does_dry_run_throw_error

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def does_dry_run_throw_error(self, cmd):

        env = os.environ.copy()
        if self.sanitizer == 'asan':
            spectrum_asan_options(env)

        try:
            out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True, env=env)
        except Exception, e:
            # OR condition is bug fix for compute shell returning negative instead of positive code
            return (e.returncode > 128 or e.returncode < 0) 
开发者ID:test-pipeline,项目名称:orthrus,代码行数:13,代码来源:afl_sancov.py

示例14: run_cmd

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def run_cmd(self, cmd, collect, env=None):

        out = []

        if self.args.verbose:
            self.logr("    CMD: %s" % cmd)

        fh = None
        if self.args.disable_cmd_redirection or collect == self.Want_Output:
            fh = open(self.cov_paths['tmp_out'], 'w')
        else:
            fh = open(os.devnull, 'w')

        if env is None:
            subprocess.call(cmd, stdin=None,
                            stdout=fh, stderr=subprocess.STDOUT, shell=True, executable='/bin/bash')
        else:
            subprocess.call(cmd, stdin=None,
                            stdout=fh, stderr=subprocess.STDOUT, shell=True, env=env, executable='/bin/bash')

        fh.close()

        if self.args.disable_cmd_redirection or collect == self.Want_Output:
            with open(self.cov_paths['tmp_out'], 'r') as f:
                for line in f:
                    out.append(line.rstrip('\n'))

        return out 
开发者ID:test-pipeline,项目名称:orthrus,代码行数:30,代码来源:afl_sancov.py

示例15: call

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import STDOUT [as 别名]
def call(command, output):
      output = subprocess.check_output(' '.join(command), stderr=subprocess.STDOUT,shell=True)+'\n'
      return output

    #override this function in each wrapper...
    #this is an older pipeline and not for somatic, will do a new somatic 
开发者ID:TheJacksonLaboratory,项目名称:SVE,代码行数:8,代码来源:delly.py


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