add win32.capture_output()
This commit is contained in:
parent
8d3e474436
commit
fb4a49b570
1 changed files with 14 additions and 0 deletions
|
@ -163,6 +163,20 @@ def RegDeleteTree(key, subkey):
|
|||
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):
|
||||
"""
|
||||
Configures the Windows service named ``name`` such that its startup type is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue