프로세스 종료 대기 로직 수정

This commit is contained in:
2023-06-26 22:38:29 +09:00
parent 58897522a7
commit 9590de2e00

View File

@ -9,6 +9,7 @@ import (
"os/exec"
"path"
"strconv"
"time"
)
func copy(src, dst string) error {
@ -63,11 +64,20 @@ func main() {
if err != nil {
stdlog.Fatal(err)
}
for {
stdlog.Println("wait for terminating of", args[3])
proc, err := os.FindProcess(pid)
if err != nil {
stdlog.Fatal(err)
}
proc.Wait()
state, _ := proc.Wait()
if state == nil {
break
}
time.Sleep(time.Second)
}
selfext, _ := os.Executable()
selfext = path.Base(selfext)