redirectOutputFor(child)
await waitFor(child)
}
const redirectOutputFor = (child) => {
const printStdout = (data) => {
process.stdout.write(data.toString())
}
const printStderr = (data) => {
process.stderr.write(data.toString())
}
child.stdout.on('data', printStdout)
child.stderr.on('data', printStderr)
child.once('close', () => {
child.stdout.off('data', printStdout)
child.stderr.off('data', printStderr)
})
}