4141# function then you can't pass shell=True on Linux. If you pass
4242# then it will execute args[0] and ignore others args.
4343
44+ # NOTE 2: When calling os.system() returned value may be 256 when eg.
45+ # when running unit tests fail. If you pass 256 to sys.exit
46+ # an undefined result will occur. In my case on Linux it caused
47+ # that other script that called it sys.exit(256) was interpreted
48+ # for the script execute successfully. So never pass to sys.exit
49+ # a value returned from os.system. Check the value and call
50+ # sys.exit(1).
51+
4452# How to debug on Linux (OLD unsupported).
4553# 1. Install "python-dbg" package
4654# 2. Install "python-wxgtk2.8-dbg" package
@@ -753,7 +761,10 @@ def build_cefpython_module():
753761 args .extend (sys .argv [1 :])
754762 command = " " .join (args )
755763 ret = subprocess .call (command , shell = True )
756- sys .exit (ret )
764+ # Always pass fixed value to sys.exit, read note at
765+ # the top of the script about os.system and sys.exit
766+ # issue.
767+ sys .exit (0 if ret == 0 else 1 )
757768 else :
758769 print ("[build.py] ERROR: failed to build the cefpython module" )
759770 sys .exit (1 )
@@ -823,7 +834,7 @@ def install_and_run():
823834 ret = os .system (command )
824835 if ret != 0 :
825836 print ("[build.py] ERROR while making installer package" )
826- sys .exit (ret )
837+ sys .exit (1 )
827838
828839 # Install
829840 print ("[build.py] Install the cefpython package" )
@@ -834,7 +845,7 @@ def install_and_run():
834845 ret = os .system (command )
835846 if ret != 0 :
836847 print ("[build.py] ERROR while installing package" )
837- sys .exit (ret )
848+ sys .exit (1 )
838849 os .chdir (BUILD_DIR )
839850
840851 # Delete setup installer directory after the package was installed
@@ -849,7 +860,7 @@ def install_and_run():
849860 ret = os .system (command )
850861 if ret != 0 :
851862 print ("[build.py] ERROR while running unit tests" )
852- sys .exit (ret )
863+ sys .exit (1 )
853864
854865 # Run examples
855866 if not NO_RUN_EXAMPLES :
0 commit comments