def call_capturing(arguments, input = None, preexec_fn = None):

    popened = None

    try:
        # launch the subprocess
        popened = \
            subprocess.Popen(
                arguments,
                stdin      = subprocess.PIPE,
                stdout     = subprocess.PIPE,
                stderr     = subprocess.PIPE,
                preexec_fn = preexec_fn,
                )

        # wait for its natural death
        (stdout, stderr) = popened.communicate(input)
    except:
        #raised = Raised()

        if popened is not None and popened.poll() is None:
            #try:
            popened.kill()
            popened.wait()
            #except:
                #Raised().print_ignored()

        #raised.re_raise()
    else:
        return (stdout, stderr, popened.returncode)
Spawn a process and return its output and status code.
dataset/ETHPy150Open borg-project/borg/borg/util.py/call_capturing