文章详情页
node.js - node exec 执行没反应
浏览:81日期:2024-07-28 11:46:36
问题描述
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}`); });
为什么执行这段语句,完全没反应?
而在终端执行完全正常。
问题解答
回答1:exec的默认的最大允许输出到stdout和stderr的数据量不超过200K,如果超过了,子进程就会被杀死。
来,给你一个门 https://segmentfault.com/q/10...
相关文章:
1. mysql - 分库分表、分区、读写分离 这些都是用在什么场景下 ,会带来哪些效率或者其他方面的好处2. css - 移动端 oppo 手机之 Border-radius3. 关于Mysql联合查询4. python 计算两个时间相差的分钟数,超过一天时计算不对5. 人工智能 - python 机器学习 医疗数据 怎么学6. 如何修改phpstudy的phpmyadmin放到其他地方7. javascript - vue-echarts-v3使用的过程中折线图区域呈渐变色。8. 爬虫图片 - 关于Python 爬虫的问题9. pip安装提示Twisted错误问题(Python3.6.4安装Twisted错误)10. c++ - 请问MySQL_Connection::isReadOnly 怎么解决?
排行榜
