From fb304981536722ef42c9688b0688d4be048ccfd1 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Fri, 18 Sep 2015 17:37:09 +0100 Subject: [PATCH] Catch WindowsError in call_silently Signed-off-by: Aanand Prasad --- compose/cli/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compose/cli/utils.py b/compose/cli/utils.py index 0b7ac683d..26a38af06 100644 --- a/compose/cli/utils.py +++ b/compose/cli/utils.py @@ -85,7 +85,12 @@ def call_silently(*args, **kwargs): Like subprocess.call(), but redirects stdout and stderr to /dev/null. """ with open(os.devnull, 'w') as shutup: - return subprocess.call(*args, stdout=shutup, stderr=shutup, **kwargs) + try: + return subprocess.call(*args, stdout=shutup, stderr=shutup, **kwargs) + except WindowsError: + # On Windows, subprocess.call() can still raise exceptions. Normalize + # to POSIXy behaviour by returning a nonzero exit code. + return 1 def is_mac():