d6c50ed623
* windows: fix config, IPC, path, and Lua compatibility * spotify: share API structures and helper so tests compile on Windows * windows: address PR comments and fix socket unavailable detection, tasklist matching, api_fs tests, and doc comment * windows: address remaining PR reviews (table-driven tests, m3u resolve comments & tests, blockquote formatting, and site/index.html description) * feat: implement cross-platform IPC server with Unix and Windows support * feat: implement Unix socket IPC server and Windows process liveness check * ipc: detect dead processes via os.ErrProcessDone os.Process.Signal converts ESRCH to os.ErrProcessDone since Go 1.16, so comparing against raw syscall.ESRCH never matched and a stale socket from a crashed instance made NewServer fail instead of cleaning it up. * windows: simplify fs allowlist normalization, exec env, and ipc error checks - normalize write allow-dirs once in the memoized writeAllowDirs - collapse duplicate test helpers and repeated getenv blocks - drop redundant errors.As branch; name WSAECONNREFUSED - revert single-entry table test to linear form - gofmt: trailing newlines and indentation --------- Co-authored-by: Bjarne Øverli <bjarne.oeverli@gmail.com>
23 lines
504 B
Go
23 lines
504 B
Go
//go:build windows
|
|
|
|
package luaplugin
|
|
|
|
import "os"
|
|
|
|
func minimalExecEnv() []string {
|
|
home := homeEnv()
|
|
env := []string{
|
|
"PATH=" + os.Getenv("PATH"),
|
|
"HOME=" + home,
|
|
"USERPROFILE=" + home,
|
|
}
|
|
// Pass through the Windows variables subprocesses commonly need; skip
|
|
// any that are unset.
|
|
for _, key := range []string{"APPDATA", "LOCALAPPDATA", "ComSpec", "PATHEXT", "SystemRoot", "WINDIR", "TEMP", "TMP"} {
|
|
if v := os.Getenv(key); v != "" {
|
|
env = append(env, key+"="+v)
|
|
}
|
|
}
|
|
return env
|
|
}
|