diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-03-22 14:43:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 14:43:31 +0100 |
commit | 3675570a391b1a49ddd198b4c7e71e17701d4404 (patch) | |
tree | 0b2b7f0b69972d2407775114e5592487429c3860 | |
parent | 53363b761cb183bf26fdd19928f31ee16bdefdcd (diff) | |
parent | 68495ea0ee0ef26863f661cbe8c1f124e7ef1efd (diff) |
- **PR Description**
Running WSL without a container would be treated as native linux,
causing problems at it would then attempt to use `xdg-open`. This was
caused by `isContainer()` always returning true due to some dubious
conditionals. These have been removed.
The env-var check seems to not be used by lazygit, nor any common
containers, and therefore appears to only exist to manually tell lazygit
to behave as if it were inside of a container. This functionality has
been kept, but the env-var has been changed to be all uppercaps as to
comply with the POSIX standard.
Fixes #2757
Bug introduced in 4d78d76
-rw-r--r-- | pkg/config/config_linux.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/pkg/config/config_linux.go b/pkg/config/config_linux.go index 892e58de3..8aaea4576 100644 --- a/pkg/config/config_linux.go +++ b/pkg/config/config_linux.go @@ -12,16 +12,9 @@ func isWSL() bool { func isContainer() bool { data, err := os.ReadFile("/proc/1/cgroup") - - if strings.Contains(string(data), "docker") || + return err == nil && (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 + os.Getenv("CONTAINER") != "") } // GetPlatformDefaultConfig gets the defaults for the platform |