feat/muzan
Evan Chen 2021-11-12 14:29:47 +08:00
parent ef76eff228
commit 69ad2a961c
1 changed files with 8 additions and 5 deletions

View File

@ -86,12 +86,15 @@ func (f *File) Do(CmdTimeout time.Duration) (string, error) {
}
f.owner.log.Info("DO: ", f.Cmd)
done := make(chan string, 1)
go func() {
var b bytes.Buffer
cmd.Stdout = &b
cmd.Stderr = &b
cmd.Start()
err := cmd.Start()
if err != nil {
f.owner.log.Error("cmd start error: ", err)
panic(err)
}
go func() {
f.pid = cmd.Process.Pid
cmd.Wait()
done <- b.String()