Skip to content

Commit 427b6b4

Browse files
author
Florian Heinze
committed
BUGFIX: interactive terminal calls now working
1 parent ccbda54 commit 427b6b4

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

main.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"github.com/logrusorgru/aurora/v3"
88
"log"
99
"os"
10-
"os/exec"
1110
"path/filepath"
1211
"regexp"
1312
"strings"
13+
"syscall"
1414
)
1515

1616
const DEV_SCRIPT_MARKER = "DEV_SCRIPT_MARKER"
@@ -160,13 +160,14 @@ func execDevScriptWithArguments(devScriptPath string, arguments []string) {
160160
log.Fatalf("Failed to execute: '%s'", err.Error())
161161
}
162162

163-
cmd := exec.Command(devScriptPath, arguments...)
164-
cmd.Stdout = os.Stdout
165-
cmd.Stderr = os.Stderr
166-
// Run will wait for the process to finish
167-
err = cmd.Run()
163+
// We tried using exec.Command(devScriptPath, arguments...) which failed for interactive
164+
// terminal calls, e.g. `docker compose exec neos /bin/bash` This is running our command
165+
// as a child process. We are now replacing the process of this helper with the call of
166+
// the `dev.sh` using `syscall.Exec()`
167+
err = syscall.Exec(devScriptPath, append([]string{devScriptPath}, arguments...), os.Environ())
168168
if err != nil {
169169
log.Fatalf("Failed to run shell script: '%s'", err.Error())
170170
}
171-
// IMPORTANT: no exit here as we do not want to kill the spanned child process!
171+
// IMPORTANT: As we are replacing the process of the helper nothing else will be
172+
// called, except the error handler!
172173
}

0 commit comments

Comments
 (0)