Skip to content

Add the _Exit symbol #4097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Richard Cook <rcook@tableau.com> (copyright owned by Tableau Software, Inc.)
* Arnab Choudhury <achoudhury@tableau.com> (copyright owned by Tableau Software, Inc.)
* Charles Vaughn <cvaughn@tableau.com> (copyright owned by Tableau Software, Inc.)
* Pierre Krieger <pierre.krieger1708@gmail.com>
4 changes: 4 additions & 0 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ LibraryManager.library = {
exit: function(status) {
__exit(status);
},
_Exit__deps: ['exit'],
_Exit: function(status) {
__exit(status);
},

_ZSt9terminatev__deps: ['exit'],
_ZSt9terminatev: function() {
Expand Down
10 changes: 8 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('''
Expand All @@ -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'''
Expand Down