diff mbox

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

Message ID 1483456542-7522-5-git-send-email-abalutoiu@cloudbasesolutions.com
State Superseded
Headers show

Commit Message

Alin Balutoiu Jan. 3, 2017, 3:16 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>
---
V2: Removed creationFlags from where it was not needed.
---
 vtep/ovs-vtep | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Alin Balutoiu Jan. 3, 2017, 4:27 p.m. UTC | #1
Please ignore this patch, I will send another one soon.

Thanks,
Alin Balutoiu.

> -----Original Message-----
> From: Alin Balutoiu
> Sent: Tuesday, January 3, 2017 5:17 PM
> To: dev@openvswitch.org
> Cc: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
> Subject: [PATCH V2 4/5] Python tests: Set CREATE_NO_WINDOW flag for
> Popen
> 
> 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>
> ---
> V2: Removed creationFlags from where it was not needed.
> ---
>  vtep/ovs-vtep | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> 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:
> --
> 2.10.0.windows.1
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: