From 0ad3b0421f13be3d1e3288d7858c21e55d495e91 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@intel.com>
Date: Thu, 29 Sep 2016 08:53:35 -0300
Subject: [PATCH] waf: let wrapper exit with error

It's not useful to raise an excpetion because it will only report the
command called exit with an error. Just return an error code instead of
rasing an exception. This way we get nicer error messages:

    ./waf unknowncommand
    No function unknowncommand defined in /home/lucas/p/dronecode/ardupilot/wscript

vs

    ./waf unknowncommand
    No function unknowncommand defined in /home/lucas/p/dronecode/ardupilot/wscript
    Traceback (most recent call last):
      File "./waf", line 15, in <module>
        raise e
    subprocess.CalledProcessError: Command '['python', '/home/lucas/p/dronecode/ardupilot/modules/waf/waf-light', 'unknowncommand']' returned non-zero exit status 1
---
 waf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/waf b/waf
index e5b89b5188..980e6a0ce8 100755
--- a/waf
+++ b/waf
@@ -12,7 +12,7 @@ try:
     subprocess.check_call(['python', waf_light] + sys.argv[1:])
 except subprocess.CalledProcessError as e:
     if e.returncode != 2 or p.isfile(waf_light):
-        raise e
+        sys.exit(1)
 
     print('Missing waf submodule. Trying to get it')
 
-- 
GitLab