1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-02 23:27:32 +02:00
This commit is contained in:
Humble Penguin 2023-03-05 06:47:21 +05:00
parent 40a29fd622
commit e94ff63bc5

View File

@ -2,6 +2,7 @@ package config
import (
"io/ioutil"
"os"
"strings"
)
@ -10,9 +11,24 @@ func isWSL() bool {
return err == nil && strings.Contains(string(data), "microsoft")
}
func isContainer() bool {
data, err := ioutil.ReadFile("/proc/1/cgroup")
if
strings.Contains(string(data), "docker") ||
strings.Contains(string(data), "/lxc/") ||
[]string{string(data)}[0] != "systemd" &&
[]string{string(data)}[0] != "init" ||
os.Getenv("container") != "" {
return err == nil && true
}
return err == nil && false
}
// GetPlatformDefaultConfig gets the defaults for the platform
func GetPlatformDefaultConfig() OSConfig {
if isWSL() {
if isWSL() && !isContainer() {
return OSConfig{
EditCommand: ``,
EditCommandTemplate: "",