summaryrefslogtreecommitdiff
path: root/go/cmd/gitlab-shell/main.go
blob: 53632a14e9c4df28a3dc1efcf45b9c841a8c6c94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)
		}
	}
}