subprocess.stdout
代表子进程的 stdout 的 Readable Stream。
¥A Readable Stream that represents the child process's stdout.
如果子级生成时 stdio[1] 设置为 'pipe' 以外的任何值,那么这将是 null。
¥If the child was spawned with stdio[1] set to anything other than 'pipe',
then this will be null.
subprocess.stdout 是 subprocess.stdio[1] 的别名。这两个属性将引用相同的值。
¥subprocess.stdout is an alias for subprocess.stdio[1]. Both properties will
refer to the same value.
const { spawn } = require('node:child_process');
const subprocess = spawn('ls');
subprocess.stdout.on('data', (data) => {
  console.log(`Received chunk ${data}`);
}); 如果无法成功生成子进程,则 subprocess.stdout 属性可以是 null 或 undefined。
¥The subprocess.stdout property can be null or undefined
if the child process could not be successfully spawned.