From ecee5e3db12acbe12c5fa597a94b5f2a3ddc5723 Mon Sep 17 00:00:00 2001 From: Ben Drucker Date: Mon, 5 Feb 2024 09:23:40 -0800 Subject: [PATCH] release: fix `$EDITOR` handling (#1971) --- tools/release/main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/release/main.go b/tools/release/main.go index fcaed361e..54e5a46ee 100644 --- a/tools/release/main.go +++ b/tools/release/main.go @@ -233,7 +233,16 @@ func editFileInteractive(path string) error { if e := os.Getenv("EDITOR"); e != "" { editor = e } - return execCommand(os.Stdout, editor, path) + return execShellCommand(os.Stdout, fmt.Sprintf("%s %s", editor, path)) +} + +func execShellCommand(stdout io.Writer, command string) error { + shell := "sh" + if s := os.Getenv("SHELL"); s != "" { + shell = s + } + + return execCommand(stdout, shell, "-c", command) } func execCommand(stdout io.Writer, name string, args ...string) error {