///|
/// True when a person sees the standard error in a terminal.
///
/// The wasm runtime cannot say this on Windows, so the answer is false there. On the
/// other systems, `/dev/stderr` is the file of the standard error.
#cfg(target="wasm")
async fn stderr_is_terminal() -> Bool noraise {
guard !(@async.platform is Windows) else { return false }
(@fs.kind("/dev/stderr") is CharDevice) catch {
_ => false
}
}
///|
#cfg(target="native")
fn stderr_is_terminal() -> Bool {
is_terminal(2) != 0
}
///|
#cfg(all(target="native", platform="windows"))
extern "C" fn is_terminal(fd : Int32) -> Int32 = "_isatty"
///|
#cfg(all(target="native", not(platform="windows")))
extern "C" fn is_terminal(fd : Int32) -> Int32 = "isatty"