/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/commands/oscommands/os_default_platform.go
54 строки
1 KB
Stefan Haller
Abstract task command over *exec.Cmd
03 июл 2026, 19:47
03 июл 2026, 19:47
8ec4283
Код
Авторство
О чём код?
//go:build !windows package oscommands import ( "os" "os/exec" "runtime" "strings" "syscall" ) func GetPlatform() *Platform { shell := getUserShell() prefixForShellFunctionsFile := "" if strings.HasSuffix(shell, "bash") { prefixForShellFunctionsFile = "shopt -s expand_aliases\n" } return &Platform{ OS: runtime.GOOS, Shell: shell, ShellArg: "-c", PrefixForShellFunctionsFile: prefixForShellFunctionsFile, OpenCommand: "open {{filename}}", OpenLinkCommand: "open {{link}}", } } func getUserShell() string { if shell := os.Getenv("SHELL"); shell != "" { return shell } return "bash" } func (c *OSCommand) UpdateWindowTitle() error { return nil } // setRawCmdLine is the non-Windows no-op counterpart of the Windows shim // (see the comment there). NewShell's shell-building logic is portable, so // this call is reached on every host; only the Windows build does anything. func setRawCmdLine(cmd *exec.Cmd, cmdLine string) {} func TerminateProcessGracefully(proc *os.Process) error { if proc == nil { return nil } return proc.Signal(syscall.SIGTERM) }