add win32.capture_output()

This commit is contained in:
Lance Edgar 2012-11-09 08:59:58 -08:00
parent 8d3e474436
commit fb4a49b570

View file

@ -163,6 +163,20 @@ def RegDeleteTree(key, subkey):
pass pass
def capture_output(command):
"""
Runs ``command`` and returns any output it produces.
"""
# We *need* to pipe ``stdout`` because that's how we capture the output of
# the ``hg`` command. However, we must pipe *all* handles in order to
# prevent issues when running as a GUI but *from* the Windows console.
# See also: http://bugs.python.org/issue3905
kwargs = dict(stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = subprocess.Popen(command, **kwargs).communicate()[0]
return output
def delayed_auto_start_service(name): def delayed_auto_start_service(name):
""" """
Configures the Windows service named ``name`` such that its startup type is Configures the Windows service named ``name`` such that its startup type is