Skip to content

Commit 662dc86

Browse files
committed
Merge pull request #4097 from tomaka/exit-symbol
Add the _Exit symbol
2 parents 7759b2f + 92236a8 commit 662dc86

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7567,7 +7567,12 @@ def test_exit_status(self):
75677567
int main() {
75687568
atexit(cleanup); // this atexit should still be called
75697569
printf("hello, world!\n");
7570-
exit(118); // Unusual exit status to make sure it's working!
7570+
// Unusual exit status to make sure it's working!
7571+
if (CAPITAL_EXIT) {
7572+
_Exit(118);
7573+
} else {
7574+
exit(118);
7575+
}
75717576
}
75727577
'''
75737578
open('post.js', 'w').write('''
@@ -7577,7 +7582,8 @@ def test_exit_status(self):
75777582
Module.callMain();
75787583
''')
75797584
self.emcc_args += ['-s', 'INVOKE_RUN=0', '--post-js', 'post.js']
7580-
self.do_run(src, 'hello, world!\ncleanup\nI see exit status: 118')
7585+
self.do_run(src.replace('CAPITAL_EXIT', '0'), 'hello, world!\ncleanup\nI see exit status: 118')
7586+
self.do_run(src.replace('CAPITAL_EXIT', '1'), 'hello, world!\ncleanup\nI see exit status: 118')
75817587

75827588
def test_noexitruntime(self):
75837589
src = r'''

0 commit comments

Comments
 (0)