emscripten-core / emscripten-core/emscripten
`exit()` under node does not obey `EXIT_RUNTIME`
- Lingua principale
- C++
- Stelle
- 27.6k
- Fork
- 3.6k
- Merge medio
- 1g 14h
- PR unite (30g)
- 125
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia dal percorso quit_ utilizzato da exit() e verifica come viene gestito process['exit'] in Node rispetto all’ambiente di esecuzione web. Riproduci il programma fornito EXIT_RUNTIME=0 in entrambi gli ambienti, quindi verifica che il comportamento e il messaggio diagnostico riflettano coerentemente se l’esecuzione asincrona continua.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, node.js, wasm
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100