diff --git a/src/cp/cp.js b/src/cp/cp.js index ef3f8a1118..c9ba3f4482 100644 --- a/src/cp/cp.js +++ b/src/cp/cp.js @@ -7,26 +7,26 @@ const __dirname = dirname(__filename); const spawnChildProcess = async (args) => { const scriptPath = join(__dirname, 'script.js'); - const child = fork(scriptPath, args, { + const children = fork(scriptPath, args, { silent: true, stdio: ['pipe', 'pipe', 'pipe', 'ipc'] }); process.stdin.on('data', (data) => { - child.send({ type: 'stdin', data: data.toString() }); + children.send({ type: 'stdin', data: data.toString() }); }); - child.on('message', (message) => { + children.on('message', (message) => { if (message.type === 'stdout') { process.stdout.write(message.data); } }); - child.on('error', (err) => { + children.on('error', (err) => { console.error('Child process error:', err); }); - child.on('exit', (code) => { + children.on('exit', (code) => { console.log(`Child process exited with code ${code}`); }); };