{"record":{"id":"1f61385ce5812720","repo":"wavetermdev/waveterm","slug":"process-group-id-not-supported-on-windows","errorCode":null,"errorMessage":"process group id not supported on windows","messagePattern":"process group id not supported on windows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/util/unixutil/unixutil_windows.go","lineNumber":14,"sourceCode":"// Copyright 2026, Command Line Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n//go:build windows\n\npackage unixutil\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc GetProcessGroupId(pid int) (int, error) {\n\treturn 0, fmt.Errorf(\"process group id not supported on windows\")\n}\n\nfunc ParseSignal(sigName string) os.Signal {\n\treturn nil\n}\n\nfunc GetSignalName(sig os.Signal) string {\n\tif sig == nil {\n\t\treturn \"\"\n\t}\n\treturn sig.String()\n}\n\nfunc SetCloseOnExec(fd int) {\n}\n\nfunc SignalTerm(pid int) error {\n\tproc, err := os.FindProcess(pid)","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/util/unixutil/unixutil_windows.go#L1-L32","documentation":"GetProcessGroupId is the Windows stub of a cross-platform unixutil API; process group IDs are a POSIX concept (getpgid) with no Windows equivalent, so the stub unconditionally returns this error. Any code path calling it on a Windows build will always fail.","triggerScenarios":"Calling GetProcessGroupId on a Windows build of the codebase — e.g. job-control or remote-process code that assumes Unix semantics without a GOOS check or build tag.","commonSituations":"Cross-platform tools that compile everywhere but test signal/job-control paths only on Linux/macOS; CI runs on Windows revealing the stub; developers porting POSIX process-management code to Windows.","solutions":["Gate the call behind runtime.GOOS != \"windows\" (or a !windows build tag) and provide a Windows-appropriate alternative","On Windows, use the Job Object API or process tree enumeration instead of POSIX process groups if grouping is actually required","Degrade gracefully: treat \"group id unavailable\" as a non-fatal condition when the caller only needs it for signal-broadcast features","Refactor call sites to depend on an interface with platform implementations so unsupported operations are explicit"],"exampleFix":"// before\npgid, err := unixutil.GetProcessGroupId(pid) // always errors on windows\n// after\nif runtime.GOOS == \"windows\" {\n    // skip group-based logic; signal the single pid directly\n    return unixutil.SendSignalByName(pid, \"SIGTERM\") // or handle per-OS\n}\npgid, err := unixutil.GetProcessGroupId(pid)","handlingStrategy":"fallback","validationCode":"if runtime.GOOS == \"windows\" {\n    return errors.New(\"process group id unavailable on windows\")\n}","typeGuard":"func canUseProcessGroups() bool { return runtime.GOOS != \"windows\" }","tryCatchPattern":"pgid, err := unixutil.GetProcessGroupId(pid)\nif err != nil && strings.Contains(err.Error(), \"not supported on windows\") {\n    pgid = pid // fallback: treat pid as its own group / skip grouping\n}","preventionTips":["Gate POSIX-specific process APIs behind GOOS checks or build tags","Add Windows CI runs to catch stub-only code paths","Define an interface with per-OS implementations so unsupported ops are explicit"],"tags":["windows","process","platform-support","go"],"backgroundTag":"unsupported-on-windows","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}