Skip to content

Commit 92236a8

Browse files
committed
Add the _Exit symbol
1 parent 6e58639 commit 92236a8

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,4 @@ a license to everyone to use it as detailed in LICENSE.)
235235
* Richard Cook <[email protected]> (copyright owned by Tableau Software, Inc.)
236236
* Arnab Choudhury <[email protected]> (copyright owned by Tableau Software, Inc.)
237237
* Charles Vaughn <[email protected]> (copyright owned by Tableau Software, Inc.)
238+
* Pierre Krieger <[email protected]>

src/library.js

+4
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ LibraryManager.library = {
494494
exit: function(status) {
495495
__exit(status);
496496
},
497+
_Exit__deps: ['exit'],
498+
_Exit: function(status) {
499+
__exit(status);
500+
},
497501

498502
_ZSt9terminatev__deps: ['exit'],
499503
_ZSt9terminatev: function() {

tests/test_core.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -7552,7 +7552,12 @@ def test_exit_status(self):
75527552
int main() {
75537553
atexit(cleanup); // this atexit should still be called
75547554
printf("hello, world!\n");
7555-
exit(118); // Unusual exit status to make sure it's working!
7555+
// Unusual exit status to make sure it's working!
7556+
if (CAPITAL_EXIT) {
7557+
_Exit(118);
7558+
} else {
7559+
exit(118);
7560+
}
75567561
}
75577562
'''
75587563
open('post.js', 'w').write('''
@@ -7562,7 +7567,8 @@ def test_exit_status(self):
75627567
Module.callMain();
75637568
''')
75647569
self.emcc_args += ['-s', 'INVOKE_RUN=0', '--post-js', 'post.js']
7565-
self.do_run(src, 'hello, world!\ncleanup\nI see exit status: 118')
7570+
self.do_run(src.replace('CAPITAL_EXIT', '0'), 'hello, world!\ncleanup\nI see exit status: 118')
7571+
self.do_run(src.replace('CAPITAL_EXIT', '1'), 'hello, world!\ncleanup\nI see exit status: 118')
75667572

75677573
def test_noexitruntime(self):
75687574
src = r'''

0 commit comments

Comments
 (0)