emscripten-core / emscripten-core/emscripten
`exit()` under node does not obey `EXIT_RUNTIME`
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
The following program will tick forever (since `EXIT_RUNTIME` defaults to 0):
```
#include
#include
int main() {
EM_ASM(
function f() { err('tick'); setTimeout(f, 1000); }
setTimeout(f, 1000);
);
return 0;
}
```
However if we change `return 0` to `exit(0)` then the program ticks forever on the web, but not under node.
Under node we see the message but the program immediately exits without ever showing a tick:
```
program exited (with status: 0), but EXIT_RUNTIME is not set, so halting
execution but not exiting the runtime or preventing further async execution
(build with EXIT_RUNTIME=1, if you want a true shutdown)
```
On the web we see the same message but we tick forever.
This is because the `exit()` calls `quit_` which calls `process['exit']`.
Is this indented behaviour? If so the message seems wrong.
Contributor guide
Assessment
This issue has not been assessed yet.