def test_exit_status(self):
    self.set_setting('EXIT_RUNTIME', 1)
    src = '\n      #include <stdio.h>\n      #include <stdlib.h>\n      static void cleanup() {\n        printf("cleanup\\n");\n      }\n\n      int main() {\n        atexit(cleanup); // this atexit should still be called\n        printf("hello, world!\\n");\n        // Unusual exit status to make sure it\'s working!\n        if (CAPITAL_EXIT) {\n          _Exit(118);\n        } else {\n          exit(118);\n        }\n      }\n    '
    create_test_file('pre.js', "\n      Module.preInit = function() {\n        addOnExit(function () {\n          out('I see exit status: ' + EXITSTATUS);\n        });\n      }\n      ")
    self.emcc_args += ['--pre-js', 'pre.js']
    self.do_run(src.replace('CAPITAL_EXIT', '0'), 'hello, world!\ncleanup\nI see exit status: 118', assert_returncode=None)
    self.do_run(src.replace('CAPITAL_EXIT', '1'), 'hello, world!\ncleanup\nI see exit status: 118', assert_returncode=None)
def test_exit_status(self):
    self.set_setting('EXIT_RUNTIME', 1)
    src = '\n      #include <stdio.h>\n      #include <stdlib.h>\n      static void cleanup() {\n        printf("cleanup\\n");\n      }\n\n      int main() {\n        atexit(cleanup); // this atexit should still be called\n        printf("hello, world!\\n");\n        // Unusual exit status to make sure it\'s working!\n        if (CAPITAL_EXIT) {\n          _Exit(118);\n        } else {\n          exit(118);\n        }\n      }\n    '
    create_test_file('pre.js', "\n      Module.preInit = function() {\n        addOnExit(function () {\n          out('I see exit status: ' + EXITSTATUS);\n        });\n      }\n      ")
    self.emcc_args += ['--pre-js', 'pre.js']
    self.do_run(src.replace('CAPITAL_EXIT', '0'), 'hello, world!\ncleanup\nI see exit status: 118', assert_returncode=None)
    self.do_run(src.replace('CAPITAL_EXIT', '1'), 'hello, world!\ncleanup\nI see exit status: 118', assert_returncode=None)