We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa82cbc commit a28db5fCopy full SHA for a28db5f
doc/api/child_process.md
@@ -914,6 +914,23 @@ The `'close'` event is emitted when the stdio streams of a child process have
914
been closed. This is distinct from the [`'exit'`][] event, since multiple
915
processes might share the same stdio streams.
916
917
+```js
918
+const { spawn } = require('child_process');
919
+const ls = spawn('ls', ['-lh', '/usr']);
920
+
921
+ls.stdout.on('data', (data) => {
922
+ console.log(`stdout: ${data}`);
923
+});
924
925
+ls.on('close', (code) => {
926
+ console.log(`child process close all stdio with code ${code}`);
927
928
929
+ls.on('exit', (code) => {
930
+ console.log(`child process exited with code ${code}`);
931
932
+```
933
934
### Event: 'disconnect'
935
<!-- YAML
936
added: v0.7.2
0 commit comments