【发布时间】:2021-03-07 20:02:12
【问题描述】:
例如,在 node.js 中,我创建了这样的子进程
child_process.spawn('powershell.exe', ['-executionpolicy', 'remotesigned', '-File', 'save_site_login_web.ps1', data.app_catalogue_url, data.ids.join(",")], { windowsHide:true });
const handler = (data) => {
// send data to client
};
watcher_shell.stdout.on('data', handler);
watcher_shell.stderr.on('data', handler);
但是,在子进程中,它会显示一个类似这张图片的进度条(我是通过从 powershell 终端手动运行它得到的)。顶部带有浅蓝色背景的区域是静态的并保持在顶部,而其中的文本会更新。
但是,此进度文本不会在 stdout 或 stderr 中捕获。如何在 node.js 中捕获此流?
谢谢
【问题讨论】:
标签: node.js powershell terminal progress-bar child-process