From 92236a82df6bf2a1b3ba1c4794a603592bdde9b4 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 13 Feb 2016 20:55:15 +0100 Subject: [PATCH] Add the _Exit symbol --- AUTHORS | 1 + src/library.js | 4 ++++ tests/test_core.py | 10 ++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 045a740dacb2b..424e0eff9661e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -235,3 +235,4 @@ a license to everyone to use it as detailed in LICENSE.) * Richard Cook (copyright owned by Tableau Software, Inc.) * Arnab Choudhury (copyright owned by Tableau Software, Inc.) * Charles Vaughn (copyright owned by Tableau Software, Inc.) +* Pierre Krieger diff --git a/src/library.js b/src/library.js index d7cdd540158a6..af0a07cc6a7ca 100644 --- a/src/library.js +++ b/src/library.js @@ -494,6 +494,10 @@ LibraryManager.library = { exit: function(status) { __exit(status); }, + _Exit__deps: ['exit'], + _Exit: function(status) { + __exit(status); + }, _ZSt9terminatev__deps: ['exit'], _ZSt9terminatev: function() { diff --git a/tests/test_core.py b/tests/test_core.py index d3d5a5296cf99..8877ccae5c2ec 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -7552,7 +7552,12 @@ def test_exit_status(self): int main() { atexit(cleanup); // this atexit should still be called printf("hello, world!\n"); - exit(118); // Unusual exit status to make sure it's working! + // Unusual exit status to make sure it's working! + if (CAPITAL_EXIT) { + _Exit(118); + } else { + exit(118); + } } ''' open('post.js', 'w').write(''' @@ -7562,7 +7567,8 @@ def test_exit_status(self): Module.callMain(); ''') self.emcc_args += ['-s', 'INVOKE_RUN=0', '--post-js', 'post.js'] - self.do_run(src, 'hello, world!\ncleanup\nI see exit status: 118') + self.do_run(src.replace('CAPITAL_EXIT', '0'), 'hello, world!\ncleanup\nI see exit status: 118') + self.do_run(src.replace('CAPITAL_EXIT', '1'), 'hello, world!\ncleanup\nI see exit status: 118') def test_noexitruntime(self): src = r'''