| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -914,6 +914,23 @@ The `'close'` event is emitted when the stdio streams of a child process have | |||
| 914 | 914 | been closed. This is distinct from the [`'exit'`][] event, since multiple | |
| 915 | 915 | processes might share the same stdio streams. | |
| 916 | 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 | + | ||
| 917 | 934 | ### Event: 'disconnect' | |
| 918 | 935 | <!-- YAML | |
| 919 | 936 | added: v0.7.2 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments