追加跟踪细粒度

This commit is contained in:
aixianling
2023-01-18 14:25:00 +08:00
parent 02001e78c2
commit ae8bf19957
2 changed files with 10 additions and 7 deletions

View File

@@ -1,9 +1,10 @@
const {exec} = require("child_process");
class Process {
constructor(cmd) {
constructor(cmd, cb) {
this.cmd = cmd
this.pid = exec(cmd, {windowsHide: true, encoding: "utf8"});
this.callback = cb
}
static new(cmd) {
@@ -28,6 +29,7 @@ class Process {
})
this.pid.stdout.on('data', data => {
console.log(data)
this.callback?.()
})
})
}