diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index da0ba7eccee..6355fea0932 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -33,14 +33,9 @@ mod options { #[cfg(all( not(feature = "feat_external_libstdbuf"), - any( - target_os = "linux", - target_os = "android", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd", - target_os = "dragonfly" - ) + unix, + not(target_vendor = "apple"), + not(target_os = "cygwin") ))] const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so")); @@ -84,14 +79,7 @@ enum ProgramOptionsError { ValueTooLarge(String), } -#[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd", - target_os = "dragonfly" -))] +#[cfg(all(unix, not(target_vendor = "apple"), not(target_os = "cygwin")))] #[expect( clippy::unnecessary_wraps, reason = "fn sig must match on all platforms" @@ -109,6 +97,15 @@ fn preload_strings() -> UResult<(&'static str, &'static str)> { Ok(("DYLD_LIBRARY_PATH", "dylib")) } +#[cfg(target_os = "cygwin")] +#[expect( + clippy::unnecessary_wraps, + reason = "fn sig must match on all platforms" +)] +fn preload_strings() -> UResult<(&'static str, &'static str)> { + Ok(("LD_PRELOAD", "dll")) +} + fn check_option(matches: &ArgMatches, name: &str) -> Result { match matches.get_one::(name) { Some(value) => match value.as_str() {