{"record":{"id":"3519136704393e47","repo":"bensadeh/tailspin","slug":"the-exec-flag-is-not-supported-on-windows","errorCode":null,"errorMessage":"The --exec flag is not supported on Windows","messagePattern":"The --exec flag is not supported on Windows","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/io/reader/command.rs","lineNumber":72,"sourceCode":"\n    let child = SharedChild::spawn(&mut sh).context(\"Could not spawn process\")?;\n\n    let stdout = child\n        .take_stdout()\n        .ok_or_else(|| anyhow!(\"Could not capture stdout of spawned process\"))?;\n\n    let reader = BufReader::with_capacity(BUF_READER_CAPACITY, stdout);\n\n    Ok(CommandReader {\n        reader,\n        child: Arc::new(child),\n        initial_read_complete_sent: false,\n    })\n}\n\n#[cfg(windows)]\nfn spawn_command(_command: String) -> Result<CommandReader> {\n    Err(anyhow!(\"The --exec flag is not supported on Windows\"))\n}\n\nimpl Drop for CommandReader {\n    fn drop(&mut self) {\n        let _ = self.child.kill();\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":80,"githubUrl":"https://github.com/bensadeh/tailspin/blob/8ecaa9a8a1bf3ba1e7457a20de11d2df75327d81/src/io/reader/command.rs#L54-L80","documentation":"The --exec feature (running the pager input from an external command) is not implemented on Windows. spawn_command unconditionally returns this error when compiled for Windows, so using --exec there always fails immediately at startup.","triggerScenarios":"Passing the --exec flag on a Windows build of the tool; CommandReader::new is called and cfg(windows) spawn_command returns this error before any process is spawned.","commonSituations":"Cross-platform scripts or CI running the tool with --exec on Windows; users migrating shell pipelines from Unix to Windows; documentation examples that assume a POSIX shell.","solutions":["Do not use --exec on Windows; pipe input via stdin instead (e.g. type file | tool)","Use WSL to run the Unix build where --exec works","Contribute/implement Windows support, e.g. via cmd /c, or gate the flag behind cfg(unix) with a clear CLI message","Run the tool inside a Unix-like environment (Git Bash with a Unix build, Cygwin, or a container)"],"exampleFix":"// before\nmyapp --exec \"cat data.txt\"   # on Windows\n// after\ntype data.txt | myapp          # Windows-compatible alternative","handlingStrategy":"validation","validationCode":"#[cfg(windows)]\nif std::env::args().any(|a| a == \"--exec\") {\n    eprintln!(\"--exec is not supported on Windows; piping via stdin instead\");\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":"match CommandReader::new(cmd) {\n    Err(e) if cfg!(windows) && e.to_string().contains(\"not supported on Windows\") => {\n        // fall back to stdin piping or WSL\n    }\n    other => other?,\n}","preventionTips":["Feature-detect platform before using --exec (cfg!(windows) / cfg!(unix))","Design pipelines to use stdin redirection, which works on all platforms","Document --exec as Unix-only in scripts and CI matrices","Prefer WSL or containers when Unix-only behavior is required on Windows hosts"],"tags":["windows","unsupported-platform","cli"],"backgroundTag":"unsupported-platform","analyzedSha":"8ecaa9a8a1bf3ba1e7457a20de11d2df75327d81","analyzedAt":"2026-09-13T19:04:00.202Z","contentChangedAt":"2026-09-13T19:04:00.202Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}