文章詳情頁
node.js - node exec 執(zhí)行沒反應(yīng)
瀏覽:97日期: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}`); });
為什么執(zhí)行這段語句,完全沒反應(yīng)?
而在終端執(zhí)行完全正常。
問題解答
回答1:exec的默認的最大允許輸出到stdout和stderr的數(shù)據(jù)量不超過200K,如果超過了,子進程就會被殺死。
來,給你一個門 https://segmentfault.com/q/10...
相關(guān)文章:
1. javascript - 數(shù)組原聲方法中的一段代碼2. python小白的基礎(chǔ)問題 關(guān)于while循環(huán)的嵌套3. MySQL客戶端吃掉了SQL注解?4. javascript - JS設(shè)置Video視頻對象的currentTime時出現(xiàn)了問題,IE,Edge,火狐,都可以設(shè)置,反而chrom卻...5. 求大神幫我看看是哪里寫錯了 感謝細心解答6. javascript - 百度echarts series數(shù)據(jù)更新問題7. python - Django分頁和查詢參數(shù)的問題8. javascript - 圖片能在網(wǎng)站顯示,但控制臺仍舊報錯403 (Forbidden)9. php自學從哪里開始?10. phpstady在win10上運行
排行榜

熱門標簽