From 9590de2e003a2e4cebec8aea48ec3da801141e45 Mon Sep 17 00:00:00 2001 From: mountain Date: Mon, 26 Jun 2023 22:38:29 +0900 Subject: [PATCH] =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=84=B8=EC=8A=A4=20?= =?UTF-8?q?=EC=A2=85=EB=A3=8C=20=EB=8C=80=EA=B8=B0=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- replacer/main.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/replacer/main.go b/replacer/main.go index e6e2fd1..5cb47c4 100644 --- a/replacer/main.go +++ b/replacer/main.go @@ -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) } - proc, err := os.FindProcess(pid) - 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) + } + state, _ := proc.Wait() + if state == nil { + break + } + + time.Sleep(time.Second) } - proc.Wait() selfext, _ := os.Executable() selfext = path.Base(selfext)