node.js - Nodejs调用CMD命令,是否有办法监控命令行运行的进度?
怪我咯
怪我咯 2017-04-17 16:18:16
0
2
588

如题,我们需要使用CMD命令去处理一些文件处理工作。
请问能否获取处理的进度,我们希望可以展示给用户看。

目前我们只能获取“成功”“失败”。
多谢。

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
大家讲道理

process.stdout will print out the output of directly executing the CMD command.

soonfy

刘奇
const exec = require('child_process').exec

const build = exec('npm run build')
build.stdout.on('data', data => console.log('stdout: ', data))
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template