From d428502df7b8e948704f5a34e3b457510e9fa2a3 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Tue, 6 May 2014 18:07:15 -0700 Subject: [PATCH 1/1] PAR2Set/utils: add the ability to redirect stdout The subprocess module supports redirecting stdout to an open file descriptor. Expose this in our wrapper. --- PAR2Set/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PAR2Set/utils.py b/PAR2Set/utils.py index 8cd9408..242f4c5 100644 --- a/PAR2Set/utils.py +++ b/PAR2Set/utils.py @@ -93,11 +93,12 @@ def hasAMatch(regex, iterateable, ignoreCase=True): # Run the specified command-list in the given directory # @cmd a list formatted for the subprocess module # @directory the directory in which to run the command +# @stdout the stdout file descriptor, following the rules of the subprocess module # @return the status code returned by the command # # Exceptions: # subprocess.CalledProcessError when the called process return code is not 0 -def runCommand(cmd, directory): +def runCommand(cmd, directory, stdout=None): logging.debug('===== BEGIN runCommand() DEBUG =====') logging.debug('Directory: %s' % directory) @@ -106,7 +107,7 @@ def runCommand(cmd, directory): logging.debug('-> %s' % arg) logging.debug('===== END runCommand() DEBUG =====') - return subprocess.check_call(cmd, cwd=directory) + return subprocess.check_call(cmd, cwd=directory, stdout=stdout) ################################################################################ -- 2.25.1