From 1f8556b2f86d7954f86f4a9a58f586a838f8ae21 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Tue, 28 Aug 2018 10:37:07 +0200 Subject: Initial feature-flagged go/ruby switch --- go/cmd/gitlab-shell/main.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 go/cmd/gitlab-shell/main.go (limited to 'go/cmd/gitlab-shell/main.go') diff --git a/go/cmd/gitlab-shell/main.go b/go/cmd/gitlab-shell/main.go new file mode 100644 index 0000000..53632a1 --- /dev/null +++ b/go/cmd/gitlab-shell/main.go @@ -0,0 +1,36 @@ +package main + +import ( + "fmt" + "os" + "path/filepath" + "syscall" + + "gitlab.com/gitlab-org/gitlab-shell/go/internal/config" +) + +func experiment() { + fmt.Println("Experiment! nothing works!") + os.Exit(1) +} + +func main() { + root := filepath.Dir(os.Args[0]) + ruby := filepath.Join(root, "gitlab-shell-ruby") + + config, err := config.New() + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + if config.Experimental { + experiment() + } else { + execErr := syscall.Exec(ruby, os.Args, os.Environ()) + if execErr != nil { + fmt.Fprintf(os.Stderr, "Failed to exec(%q): %v\n", ruby, execErr) + os.Exit(1) + } + } +} -- cgit v1.2.1