bensadeh/tailspin · error · anyhow::Error

The --exec flag is not supported on Windows

Error message

The --exec flag is not supported on Windows

What it means

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.

Solutions

  1. Do not use --exec on Windows; pipe input via stdin instead (e.g. type file | tool)
  2. Use WSL to run the Unix build where --exec works
  3. Contribute/implement Windows support, e.g. via cmd /c, or gate the flag behind cfg(unix) with a clear CLI message
  4. Run the tool inside a Unix-like environment (Git Bash with a Unix build, Cygwin, or a container)

Example fix

// before
myapp --exec "cat data.txt"   # on Windows
// after
type data.txt | myapp          # Windows-compatible alternative
Defensive patterns

Strategy: validation

Validate before calling

#[cfg(windows)]
if std::env::args().any(|a| a == "--exec") {
    eprintln!("--exec is not supported on Windows; piping via stdin instead");
    std::process::exit(2);
}

Try / catch

match CommandReader::new(cmd) {
    Err(e) if cfg!(windows) && e.to_string().contains("not supported on Windows") => {
        // fall back to stdin piping or WSL
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.


AI-assisted analysis of bensadeh/tailspin@8ecaa9a8a1 (2026-09-13). Data as JSON: /api/errors/3519136704393e47. Report an issue: GitHub.

Appendix: source

Thrown at src/io/reader/command.rs:72

    let child = SharedChild::spawn(&mut sh).context("Could not spawn process")?;

    let stdout = child
        .take_stdout()
        .ok_or_else(|| anyhow!("Could not capture stdout of spawned process"))?;

    let reader = BufReader::with_capacity(BUF_READER_CAPACITY, stdout);

    Ok(CommandReader {
        reader,
        child: Arc::new(child),
        initial_read_complete_sent: false,
    })
}

#[cfg(windows)]
fn spawn_command(_command: String) -> Result<CommandReader> {
    Err(anyhow!("The --exec flag is not supported on Windows"))
}

impl Drop for CommandReader {
    fn drop(&mut self) {
        let _ = self.child.kill();
    }
}

View on GitHub (pinned to 8ecaa9a8a1)