cosca 0.9.0

Unified cross-platform subprocess management: spawning, stdio, process trees, stable identity, and elevation.
Documentation
//! Off Windows there is no frozen spawn.

use crate::child::{Child, SuspendedChild};
use crate::command::Command;
use crate::error::Error;

/// The refusal both frozen spawns give, before anything of the command is touched or any runtime
/// is asked for.
pub(crate) fn refusal(_cmd: &Command) -> Error {
    Error::Unsupported {
        op: "spawn_suspended".into(),
        platform: std::env::consts::OS,
        detail: "a suspended spawn is implemented on Windows only: a POSIX child cannot be held \
                 before it runs without a gate in the child before exec, which std's blocking spawn \
                 does not allow"
            .into(),
        source: None,
    }
}

pub(super) fn spawn(cmd: &mut Command) -> Result<SuspendedChild, Error> {
    Err(refusal(cmd))
}

/// There is no `SuspendedChild` to resume here: `spawn` never returns one.
pub(super) fn release(_child: &Child) -> std::io::Result<()> {
    unreachable!("spawn_suspended never returns a SuspendedChild off Windows")
}