summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorAlessandro Pilotti <ap@pilotti.it>2012-11-09 20:06:31 +0200
committerAlessandro Pilotti <ap@pilotti.it>2012-11-09 20:42:45 +0200
commitc6dd816cb6f09cb0148730875f02018b4949e9b6 (patch)
tree128fce4f5e5da3d1ddc2f6f26c5581eba68cf1a7 /nova/utils.py
parentc9d01a1cc511cdb9625af8e43293a3b7569fdf51 (diff)
downloadnova-c6dd816cb6f09cb0148730875f02018b4949e9b6.tar.gz
nova-c6dd816cb6f09cb0148730875f02018b4949e9b6.tar.xz
nova-c6dd816cb6f09cb0148730875f02018b4949e9b6.zip
Fixes a bug in nova.utils, due to Windows compatibility issues.
Fixes Bug #1077121 subprocess.Popen() does not support preexec_fn and close_fds = True on Windows Change-Id: I69697b692b982c7cf786f52cc57f95b4819b50d8
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/nova/utils.py b/nova/utils.py
index d9ded16b6..5f78b93da 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -180,12 +180,20 @@ def execute(*cmd, **kwargs):
try:
LOG.debug(_('Running cmd (subprocess): %s'), ' '.join(cmd))
_PIPE = subprocess.PIPE # pylint: disable=E1101
+
+ if os.name == 'nt':
+ preexec_fn = None
+ close_fds = False
+ else:
+ preexec_fn = _subprocess_setup
+ close_fds = True
+
obj = subprocess.Popen(cmd,
stdin=_PIPE,
stdout=_PIPE,
stderr=_PIPE,
- close_fds=True,
- preexec_fn=_subprocess_setup,
+ close_fds=close_fds,
+ preexec_fn=preexec_fn,
shell=shell)
result = None
if process_input is not None: