const exec = require('child_process').exec;
exec('cat /dev/urandom |od -x|head -n 1', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
});
为什么执行这段语句,完全没反应?
而在终端执行完全正常。
exec的預設的最大允許輸出到stdout和stderr的資料量不超過200K,如果超過了,子進程就會被殺死。
來,給你一扇門 https://segmentfault.com/q/10...