summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
de371c2)
The subprocess module supports redirecting stdout to an open file
descriptor. Expose this in our wrapper.
# 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
# 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
# @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)
logging.debug('===== BEGIN runCommand() DEBUG =====')
logging.debug('Directory: %s' % directory)
logging.debug('-> %s' % arg)
logging.debug('===== END runCommand() DEBUG =====')
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)
################################################################################
################################################################################