当我从bash执行(编造和荒谬)命令banana
时,我收到以下错误:
bash: banana: command not found
但是如果我在Node.js中的banana
中执行child_process.spawn
,我会收到错误:
net.js:624
throw new TypeError('invalid data');
^
TypeError: invalid data
at WriteStream.Socket.write (net.js:624:11)
at ChildProcess.<anonymous>
at ChildProcess.emit (events.js:107:17)
at Process.ChildProcess._handle.onexit (child_process.js:1065:12)
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
有没有办法从Node.JS获取原始bash错误的文本?
答案 0 :(得分:1)
附加错误&#39; child_process.spawn的事件发射器将为您提供以下消息:
child_process_instance.on('error', function (error) {
console.log(error);
});
Error: spawn bananas ENOENT