zk/internal/util/exec/exec_unix.go
Mickaël Menu 50855154e2
Architecture (#27)
* Move everything under the internal package.
* Better separation between core and adapter packages, for easier unit testing.
* Simplify data models.
* Support multiple opened notebooks during runtime (useful for the LSP server).
* Proper surface API which might be exposed later as a public Go package.
2021-04-14 20:14:01 +02:00

19 lines
367 B
Go

// +build !windows
package exec
import (
"os"
"os/exec"
)
// CommandFromString returns a Cmd running the given command with $SHELL.
func CommandFromString(command string, args ...string) *exec.Cmd {
shell := os.Getenv("SHELL")
if len(shell) == 0 {
shell = "sh"
}
args = append([]string{"-c", command, "--"}, args...)
return exec.Command(shell, args...)
}