diff mbox

[ovs-dev,V4,4/5] Python tests: Set CREATE_NO_WINDOW flag for Popen

Message ID 1483474197-8702-5-git-send-email-abalutoiu@cloudbasesolutions.com
State Accepted
Headers show

Commit Message

Alin Balutoiu Jan. 3, 2017, 8:10 p.m. UTC
From: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>

On Windows if the flag CREATE_NO_WINDOW is not
specified when using subprocess.Popen, a new
window will appear with the new process.

The window is not necessary for the tests.
This patch addresses this issue by adding
the flag CREATE_NO_WINDOW for all subprocess.Popen
calls if the machine is running Windows.

Signed-off-by: Alin-Gheorghe Balutoiu <abalutoiu@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions>
---
V2: Removed creationFlags from where it was not needed.
V3: Changed Signed-off-by name and added previous Acked-by's, Tested-by's.
V4: No changes.
---
 vtep/ovs-vtep | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep
index 9a5aa3d..fd652d4 100755
--- a/vtep/ovs-vtep
+++ b/vtep/ovs-vtep
@@ -53,7 +53,11 @@  bfd_ref = {}
 
 def call_prog(prog, args_list):
     cmd = [prog, "-vconsole:off"] + args_list
-    output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
+    creationFlags = 0
+    if sys.platform == 'win32':
+        creationFlags = 0x08000000  # CREATE_NO_WINDOW
+    output = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+                              creationflags=creationFlags).communicate()
     if len(output) == 0 or output[0] is None:
         output = ""
     else: