Skip to content

Commit 26401c1

Browse files
committed
Add the _Exit symbol
1 parent b0982ef commit 26401c1

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

AUTHORS

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,4 @@ a license to everyone to use it as detailed in LICENSE.)
231231
* Noam T.Cohen <[email protected]>
232232
* Nick Shin <[email protected]>
233233
* Gregg Tavares <[email protected]>
234-
234+
* 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
@@ -7522,7 +7522,12 @@ def test_exit_status(self):
75227522
int main() {
75237523
atexit(cleanup); // this atexit should still be called
75247524
printf("hello, world!\n");
7525-
exit(118); // Unusual exit status to make sure it's working!
7525+
// Unusual exit status to make sure it's working!
7526+
if (CAPITAL_EXIT) {
7527+
_Exit(118);
7528+
} else {
7529+
exit(118);
7530+
}
75267531
}
75277532
'''
75287533
open('post.js', 'w').write('''
@@ -7532,7 +7537,8 @@ def test_exit_status(self):
75327537
Module.callMain();
75337538
''')
75347539
self.emcc_args += ['-s', 'INVOKE_RUN=0', '--post-js', 'post.js']
7535-
self.do_run(src, 'hello, world!\ncleanup\nI see exit status: 118')
7540+
self.do_run(src.replace('CAPITAL_EXIT', '0'), 'hello, world!\ncleanup\nI see exit status: 118')
7541+
self.do_run(src.replace('CAPITAL_EXIT', '1'), 'hello, world!\ncleanup\nI see exit status: 118')
75367542

75377543
def test_noexitruntime(self):
75387544
src = r'''

0 commit comments

Comments
 (0)