mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Merge pull request #2486 from humblepenguinn/master
This commit is contained in:
commit
4d78d76a44
1 changed files with 16 additions and 1 deletions
|
@ -2,6 +2,7 @@ package config
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -10,9 +11,23 @@ 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: "",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue