osmoutil: open /dev/null only once
Change-Id: Ic6da34f6c4c5cd3b0786788f4e38c9c6248fca1b
This commit is contained in:
parent
b59b677c9b
commit
f6ab3d8e9c
|
@ -23,9 +23,14 @@ import time
|
|||
|
||||
"""Run a command, with stdout and stderr directed to devnull"""
|
||||
|
||||
devnull = None
|
||||
|
||||
def popen_devnull(cmd, verbose=True):
|
||||
devnull = open(os.devnull, 'w')
|
||||
global devnull
|
||||
if devnull is None:
|
||||
if verbose:
|
||||
print "Opening /dev/null"
|
||||
devnull = open(os.devnull, 'w')
|
||||
if verbose:
|
||||
print "Launching: PWD=%s %s" % (os.getcwd(), ' '.join([repr(c) for c in cmd]))
|
||||
return subprocess.Popen(cmd, stdout=devnull, stderr=devnull)
|
||||
|
|
Loading…
Reference in New Issue