#![deny(missing_docs)]
pub mod audit;
pub mod capabilities;
pub mod capability;
pub mod cli;
mod dispatch;
pub mod envelope;
pub mod error;
pub mod guide;
pub mod mcp;
pub mod protocol;
pub mod safety;
pub mod transport;
pub fn reset_sigpipe() {
#[cfg(unix)]
unix_sigpipe::reset();
}
#[cfg(unix)]
mod unix_sigpipe {
const SIGPIPE: i32 = 13;
const SIG_DFL: usize = 0;
#[cfg(test)]
const SIG_IGN: usize = 1;
extern "C" {
fn signal(signum: i32, handler: usize) -> usize;
}
pub fn reset() -> usize {
unsafe { signal(SIGPIPE, SIG_DFL) }
}
#[cfg(test)]
mod tests {
use super::{reset, SIG_DFL, SIG_IGN};
#[test]
fn reset_moves_disposition_from_ignore_to_default() {
let previous = reset();
let after = reset();
assert!(previous == SIG_IGN || previous == SIG_DFL);
assert_eq!(after, SIG_DFL);
}
#[test]
fn public_reset_sigpipe_is_callable() {
crate::reset_sigpipe();
assert_eq!(reset(), SIG_DFL);
}
}
}
pub fn run(cli: cli::Cli) -> i32 {
dispatch::run(cli)
}