use std::env::consts::OS;
pub mod error;
pub mod guard_signals;
pub mod schema;
pub mod time;
pub use error::{SysprimsError, SysprimsResult};
pub use rsfulmen::foundry::exit_codes;
pub use rsfulmen::foundry::signals;
#[inline]
pub fn get_platform() -> &'static str {
OS
}
#[inline]
#[cfg(unix)]
pub const fn is_unix() -> bool {
true
}
#[inline]
#[cfg(not(unix))]
pub const fn is_unix() -> bool {
false
}
#[inline]
#[cfg(windows)]
pub const fn is_windows() -> bool {
true
}
#[inline]
#[cfg(not(windows))]
pub const fn is_windows() -> bool {
false
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_get_platform() {
let platform = get_platform();
assert!(!platform.is_empty());
assert!(
["linux", "macos", "windows", "freebsd"].contains(&platform),
"Unexpected platform: {}",
platform
);
}
#[test]
fn test_platform_detection_consistency() {
#[cfg(unix)]
{
assert!(is_unix());
assert!(!is_windows());
}
#[cfg(windows)]
{
assert!(is_windows());
assert!(!is_unix());
}
}
#[test]
fn test_rsfulmen_reexports() {
assert_eq!(signals::SIGTERM, 15);
assert_eq!(signals::SIGKILL, 9);
assert_eq!(exit_codes::EXIT_SUCCESS, 0);
assert_eq!(exit_codes::EXIT_SIGNAL_TERM, 143);
}
}