Closed
Description
- Version: '8.0.0-rc.0'
- Platform: Windows 7 x64
- Subsystem: process
process.md
states:
Listener functions must only perform synchronous operations. The Node.js
process will exit immediately after calling the'exit'
event listeners
causing any additional work still queued in the event loop to be abandoned.
In the following example, for instance, the timeout will never occur:process.on('exit', (code) => { setTimeout(() => { console.log('This will not run'); }, 0); });
However, the behavior of the code is flaky:
> test.js
> test.js
This will not run
> test.js
This will not run
> test.js
> test.js
> test.js
> test.js
This will not run
...
If this flakiness is not a bug, what would be better?
- Increase the timeout up to
1000
or something and save the categorical 'the timeout will never occur'. - State flakiness. If so, what would be preferable wordings for the description and the logged string?