diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-01 11:33:47 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-01 11:33:47 -0700 |
commit | 4e0abd190f62c3593ca130f684b5aa6d0e87e69b (patch) | |
tree | 4f0f9df5c72c5c5c28218ac88cf3c59dd179bb1f | |
parent | 94e097a1fd9b3691796356a9df3402710e0c9018 (diff) | |
parent | 209871d41d9070e6a3bc5748fadd6bd5942911ec (diff) |
Merge pull request #1098 from LCID-Fire/wrapper_exit_code_fix
Build wrapper exit code fix
-rwxr-xr-x | emconfigure | 6 | ||||
-rwxr-xr-x | emmake | 6 | ||||
-rw-r--r-- | tools/shared.py | 25 |
3 files changed, 29 insertions, 8 deletions
diff --git a/emconfigure b/emconfigure index 51e57c64..ce98af22 100755 --- a/emconfigure +++ b/emconfigure @@ -18,6 +18,10 @@ Relevant defines: import os, sys from tools import shared +from subprocess import CalledProcessError -shared.Building.configure(sys.argv[1:]) +try: + shared.Building.configure(sys.argv[1:]) +except CalledProcessError, e: + sys.exit(e.returncode) @@ -20,6 +20,10 @@ generate JavaScript. import os, sys from tools import shared +from subprocess import CalledProcessError -shared.Building.make(sys.argv[1:]) +try: + shared.Building.make(sys.argv[1:]) +except CalledProcessError, e: + sys.exit(e.returncode) diff --git a/tools/shared.py b/tools/shared.py index b4dad96f..09277d06 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -665,11 +665,14 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e if 'cmake' in args[0]: args = Building.handle_CMake_toolchain(args, env) try: - Popen(args, stdout=stdout, stderr=stderr, env=env).communicate() + process = Popen(args, stdout=stdout, stderr=stderr, env=env) + process.communicate() except Exception, e: print >> sys.stderr, 'Error: Exception thrown when invoking Popen in configure with args: "%s"!' % ' '.join(args) raise del env['EMMAKEN_JUST_CONFIGURE'] + if process.returncode is not 0: + raise subprocess.CalledProcessError(cmd=args, returncode=process.returncode) @staticmethod def make(args, stdout=None, stderr=None, env=None): @@ -680,10 +683,14 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e sys.exit(1) #args += ['VERBOSE=1'] try: - Popen(args, stdout=stdout, stderr=stderr, env=env).communicate() + process = Popen(args, stdout=stdout, stderr=stderr, env=env) + process.communicate() except Exception, e: print >> sys.stderr, 'Error: Exception thrown when invoking Popen in make with args: "%s"!' % ' '.join(args) raise + if process.returncode is not 0: + raise subprocess.CalledProcessError(cmd=args, returncode=process.returncode) + @staticmethod def build_library(name, build_dir, output_dir, generated_libs, configure=['sh', './configure'], configure_args=[], make=['make'], make_args=['-j', '2'], cache=None, cache_name=None, copy_project=False, env_init={}, source_dir=None, native=False): @@ -718,8 +725,11 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e for k, v in env_init.iteritems(): env[k] = v if configure: # Useful in debugging sometimes to comment this out (and the lines below up to and including the |link| call) - Building.configure(configure + configure_args, stdout=open(os.path.join(project_dir, 'configure_'), 'w'), - stderr=open(os.path.join(project_dir, 'configure_err'), 'w'), env=env) + try: + Building.configure(configure + configure_args, stdout=open(os.path.join(project_dir, 'configure_'), 'w'), + stderr=open(os.path.join(project_dir, 'configure_err'), 'w'), env=env) + except subprocess.CalledProcessError, e: + pass # Ignore exit code != 0 def open_make_out(i, mode='r'): return open(os.path.join(project_dir, 'make_' + str(i)), mode) @@ -729,8 +739,11 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e for i in range(2): # FIXME: Sad workaround for some build systems that need to be run twice to succeed (e.g. poppler) with open_make_out(i, 'w') as make_out: with open_make_err(i, 'w') as make_err: - Building.make(make + make_args, stdout=make_out, - stderr=make_err, env=env) + try: + Building.make(make + make_args, stdout=make_out, + stderr=make_err, env=env) + except subprocess.CalledProcessError, e: + pass # Ignore exit code != 0 try: if cache is not None: cache[cache_name] = [] |