Closed
Description
- Version: 8.5.0,8.6.0
- Platform: windows10 64-bit 1703
- Subsystem:
while using child_process/spawn for ipc mode, child process will emit an error. it didn't appear in v8.4.0 or ubuntu
D:\fe\other\project\errortest>node index
hahah
events.js:182
throw er; // Unhandled 'error' event
^
Error: write EINVAL
at _errnoException (util.js:1019:11)
at process.target._send (internal/child_process.js:704:20)
at process.target.send (internal/child_process.js:588:19)
at Object.<anonymous> (D:\fe\other\project\errortest\child.js:2:9)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
file index.js
'use strict'
const spawn = require('child_process').spawn
const path = require('path')
let dir = path.join(__dirname, 'child.js')
let server = spawn('node', [`"${dir}"`], {
stdio: ['pipe', 'ipc', 'pipe'],
shell: true,
})
server.on('message', msg => {
console.log(msg)
})
server.stderr.pipe(process.stderr)
file child.js
'use strict'
process.send('hahah')