You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
doc: recommend events.once to manage 'close' event
`events.once` is a great way to manage the `close` / `error` / `exit`
events of a child process. It creates a Promise that is fulfilled when
the EventEmitter emits the given event or that is rejected if the
EventEmitter emits 'error' while waiting.
I think a lot of people wrongly think that managing a spawned child
process requires writing boilerplate handlers for `close` and `error`,
and that there's no `promisify` solution for spawned child processes. In
fact, `events.once` is that solution. The docs should explicitly
recommend it in examples.
PR-URL: #60017
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
0 commit comments