{"record":{"id":"1c61ff20aee3e194","repo":"wtfutil/wtf","slug":"pty-mode-is-not-supported-on-windows","errorCode":null,"errorMessage":"pty mode is not supported on Windows","messagePattern":"pty mode is not supported on Windows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/cmdrunner/pty_windows.go","lineNumber":13,"sourceCode":"//go:build windows\n\npackage cmdrunner\n\nimport (\n\t\"errors\"\n\t\"os/exec\"\n)\n\n// runCommandPty is not supported on Windows. PTY mode requires Unix-specific\n// syscalls (SIGWINCH) and the creack/pty library which does not support Windows.\nfunc runCommandPty(widget *Widget, cmd *exec.Cmd) error {\n\treturn errors.New(\"pty mode is not supported on Windows\")\n}\n","sourceCodeStart":1,"sourceCodeEnd":15,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/cmdrunner/pty_windows.go#L1-L15","documentation":"cmdrunner's PTY mode allocates a pseudo-terminal via Unix syscalls (SIGWINCH) and the creack/pty library. On Windows that is unsupported, so the build-tagged pty_windows.go implementation of runCommandPty unconditionally returns this stub error. PTY output simply cannot be used on Windows.","triggerScenarios":"Configuring a cmdrunner widget with PTY mode enabled (pty: true in the module settings) on a Windows build of wtfutil; any code path that calls runCommandPty on the windows build.","commonSituations":"Sharing a config.yml between macOS/Linux and Windows machines; following Linux-focused tutorials that enable pty for interactive commands (top, htop, watch); CI validating configs cross-platform.","solutions":["Disable PTY mode for the cmdrunner module (remove/set pty: false) on Windows","Run wtfutil under WSL and configure PTY there instead of native Windows","Drop PTY mode and capture plain stdout; redesign the command to not require a TTY","If PTY is essential, use a Unix host"],"exampleFix":"# before (config.yml)\ncmdrunner:\n  args: [\"watch\", \"ls\"]\n  pty: true\n# after (Windows)\ncmdrunner:\n  args: [\"ls\"]\n  pty: false","handlingStrategy":"fallback","validationCode":"if runtime.GOOS == \"windows\" && cfg.Bool(\"pty\") {\n    return errors.New(\"disable pty on Windows\")\n}","typeGuard":"func ptySupported() bool { return runtime.GOOS != \"windows\" }","tryCatchPattern":"if err := runCommand(widget, cmd); err != nil {\n    if strings.Contains(err.Error(), \"pty mode is not supported\") {\n        return runCommandPlain(widget, cmd) // fallback to non-PTY\n    }\n    return err\n}","preventionTips":["Gate pty: true on GOOS in config generation scripts","Keep separate config profiles for Windows vs Unix","Prefer commands that don't require a TTY in widgets","Use WSL when PTY behavior is required on Windows machines"],"tags":["go","windows","platform-compatibility","pty"],"backgroundTag":"unsupported-on-windows","analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}