feat!: remove TCP socket support for server connections (#2527)

Windows has supported Unix domain sockets for quite some time now, so falling back to TCP sockets can be removed. As a result, Unix domain sockets will be used on all platforms.
This commit is contained in:
valoq authored and GitHub committed 2026-04-16 11:37:30 +10:00
1 parent 66bc58b4bf
commit 867cd99f50
5 files changed
+13 -33

No files matched your search

+2 -11
View File
@@ -9,7 +9,6 @@ import (
"path/filepath"
"slices"
"strings"
"syscall"
"golang.org/x/sys/windows"
)
@@ -26,7 +25,6 @@ var envPathExts []string
var (
gDefaultShell = "cmd"
gDefaultShellFlag = "/c"
gDefaultSocketProt = "unix"
gDefaultSocketPath string
gDefaultHiddenFiles []string
)
@@ -106,15 +104,8 @@ func init() {
gTagsPath = filepath.Join(data, "lf", "tags")
gHistoryPath = filepath.Join(data, "lf", "history")
socket, err := syscall.Socket(syscall.AF_UNIX, syscall.SOCK_STREAM, 0)
if err != nil {
gDefaultSocketProt = "tcp"
gDefaultSocketPath = "127.0.0.1:12345"
} else {
runtime := os.TempDir()
gDefaultSocketPath = filepath.Join(runtime, fmt.Sprintf("lf.%s.sock", gUser.Username))
syscall.Close(socket)
}
runtime := os.TempDir()
gDefaultSocketPath = filepath.Join(runtime, fmt.Sprintf("lf.%s.sock", gUser.Username))
s := cmp.Or(os.Getenv("PATHEXT"), ".COM;.EXE;.BAT;.CMD")
for ext := range strings.SplitSeq(s, ";") {