Skip to content

Commit 6853b33

Browse files
committed
Move shell command to variable
This commit moves the shell command to be used when executing commands into a variable, allowing it to be customized at build time using a command like: go build -ldflags "-X main.osShell=my-fancy-shell" -o forego
1 parent b125da0 commit 6853b33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

unix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"syscall"
88
)
99

10+
var osShell string = "bash"
11+
1012
const osHaveSigTerm = true
1113

1214
func ShellInvocationCommand(interactive bool, root, command string) []string {
@@ -15,7 +17,7 @@ func ShellInvocationCommand(interactive bool, root, command string) []string {
1517
shellArgument = "-ic"
1618
}
1719
shellCommand := fmt.Sprintf("cd \"%s\"; source .profile 2>/dev/null; exec %s", root, command)
18-
return []string{"bash", shellArgument, shellCommand}
20+
return []string{osShell, shellArgument, shellCommand}
1921
}
2022

2123
func (p *Process) PlatformSpecificInit() {

0 commit comments

Comments
 (0)