[node-patches] Change in ovirt-node[master]: process: Allow override of common args
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Tue Jun 11 16:08:26 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: process: Allow override of common args
......................................................................
process: Allow override of common args
Previously the common args to Popen couldn't be overriden, this is now
possible.
Change-Id: I3d0aeffe04bea7892f548662372d10a87a87cd11
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/utils/process.py
1 file changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/59/15559/1
diff --git a/src/ovirt/node/utils/process.py b/src/ovirt/node/utils/process.py
index f837a04..233849c 100644
--- a/src/ovirt/node/utils/process.py
+++ b/src/ovirt/node/utils/process.py
@@ -38,10 +38,15 @@
CalledProcessError = subprocess.CalledProcessError
+def __update_kwargs(kwargs):
+ new_kwargs = dict(COMMON_POPEN_ARGS)
+ new_kwargs.update(kwargs)
+ return new_kwargs
+
def popen(*args, **kwargs):
"""subprocess.Popen wrapper to not leak file descriptors
"""
- kwargs.update(COMMON_POPEN_ARGS)
+ kwargs = __update_kwargs(kwargs)
LOGGER.debug("Popen with: %s %s" % (args, kwargs))
return subprocess.Popen(*args, **kwargs)
@@ -49,7 +54,7 @@
def call(*args, **kwargs):
"""subprocess.call wrapper to not leak file descriptors
"""
- kwargs.update(COMMON_POPEN_ARGS)
+ kwargs = __update_kwargs(kwargs)
LOGGER.debug("Calling with: %s %s" % (args, kwargs))
return int(subprocess.call(*args, **kwargs))
@@ -57,7 +62,7 @@
def check_call(*args, **kwargs):
"""subprocess.check_call wrapper to not leak file descriptors
"""
- kwargs.update(COMMON_POPEN_ARGS)
+ kwargs = __update_kwargs(kwargs)
LOGGER.debug("Checking call with: %s %s" % (args, kwargs))
return int(subprocess.check_call(*args, **kwargs))
@@ -65,7 +70,7 @@
def check_output(*args, **kwargs):
"""subprocess.check_output wrapper to not leak file descriptors
"""
- kwargs.update(COMMON_POPEN_ARGS)
+ kwargs = __update_kwargs(kwargs)
LOGGER.debug("Checking output with: %s %s" % (args, kwargs))
return unicode(subprocess.check_output(*args, **kwargs),
encoding=sys.stdin.encoding)
--
To view, visit http://gerrit.ovirt.org/15559
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d0aeffe04bea7892f548662372d10a87a87cd11
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list