diff options
author | Nick Thomas <nick@gitlab.com> | 2019-04-10 15:09:28 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-04-12 15:16:08 +0100 |
commit | 01014c474a1cef7262ca2dafc6f33bad3225ac25 (patch) | |
tree | 65f0a53a98d64a821b1085ec101da808f684cd1c /go/cmd/gitlab-shell | |
parent | f6a7f1714763d8f0048c23f0cc75184addd6d4dc (diff) | |
download | gitlab-shell-01014c474a1cef7262ca2dafc6f33bad3225ac25.tar.gz |
Pass the root directory into the fallback command
Diffstat (limited to 'go/cmd/gitlab-shell')
-rw-r--r-- | go/cmd/gitlab-shell/main.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/go/cmd/gitlab-shell/main.go b/go/cmd/gitlab-shell/main.go index 04de4c4..6e39d8b 100644 --- a/go/cmd/gitlab-shell/main.go +++ b/go/cmd/gitlab-shell/main.go @@ -26,8 +26,9 @@ func findRootDir() (string, error) { // rubyExec will never return. It either replaces the current process with a // Ruby interpreter, or outputs an error and kills the process. -func execRuby(readWriter *readwriter.ReadWriter) { - cmd := &fallback.Command{} +func execRuby(rootDir string, readWriter *readwriter.ReadWriter) { + cmd := &fallback.Command{RootDir: rootDir, Args: os.Args} + if err := cmd.Execute(readWriter); err != nil { fmt.Fprintf(readWriter.ErrOut, "Failed to exec: %v\n", err) os.Exit(1) @@ -43,8 +44,8 @@ func main() { rootDir, err := findRootDir() if err != nil { - fmt.Fprintln(readWriter.ErrOut, "Failed to determine root directory, falling back to gitlab-shell-ruby") - execRuby(readWriter) + fmt.Fprintln(readWriter.ErrOut, "Failed to determine root directory, exiting") + os.Exit(1) } // Fall back to Ruby in case of problems reading the config, but issue a @@ -52,7 +53,7 @@ func main() { config, err := config.NewFromDir(rootDir) if err != nil { fmt.Fprintln(readWriter.ErrOut, "Failed to read config, falling back to gitlab-shell-ruby") - execRuby(readWriter) + execRuby(rootDir, readWriter) } cmd, err := command.New(os.Args, config) |