From 106368d367bc938073d333e60a0cbfeab1fee185 Mon Sep 17 00:00:00 2001 From: Matthieu Rakotojaona Date: Tue, 5 Mar 2024 14:47:05 +0100 Subject: [PATCH] Watch: allow changing directory --- acme/Watch/main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/acme/Watch/main.go b/acme/Watch/main.go index 3dab160..ede065c 100644 --- a/acme/Watch/main.go +++ b/acme/Watch/main.go @@ -259,7 +259,16 @@ func runBackground(id int, dir string) { } cmd := exec.Command(rc, "-c", string(line)) - cmd.Dir = dir + windows, err := acme.Windows() + if err == nil { + // TODO at least log it + for _, w := range windows { + if win.ID() == w.ID { + cmd.Dir = path.Dir(w.Name) + break + } + } + } r, w, err := os.Pipe() if err != nil { log.Fatal(err)