mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-20 09:47:49 +02:00
This reverts commit 67e21859644e04e771075f704084b3748c565c5b.
This commit is contained in:
parent
29a2d93873
commit
69048bfd34
@ -219,15 +219,5 @@ func openURL(cmd *cobra.Command, verificationURIComplete, userCode string) {
|
|||||||
|
|
||||||
// isLinuxRunningDesktop checks if a Linux OS is running desktop environment
|
// isLinuxRunningDesktop checks if a Linux OS is running desktop environment
|
||||||
func isLinuxRunningDesktop() bool {
|
func isLinuxRunningDesktop() bool {
|
||||||
if os.Getenv("DESKTOP_SESSION") != "" {
|
return os.Getenv("DESKTOP_SESSION") != "" || os.Getenv("XDG_CURRENT_DESKTOP") != ""
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, env := range os.Environ() {
|
|
||||||
if strings.HasPrefix(env, "XDG_") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -52,16 +51,3 @@ func TestLogin(t *testing.T) {
|
|||||||
t.Errorf("expected non empty Private key, got empty")
|
t.Errorf("expected non empty Private key, got empty")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsLinuxRunningDesktop(t *testing.T) {
|
|
||||||
if runtime.GOOS != "linux" {
|
|
||||||
t.Skip("skipping test on non-linux platform")
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Setenv("XDG_FOO", "BAR")
|
|
||||||
|
|
||||||
isDesktop := isLinuxRunningDesktop()
|
|
||||||
if !isDesktop {
|
|
||||||
t.Errorf("expected desktop environment, got false")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user