Skip to content

Commit fa1d7f7

Browse files
committed
stdbuf: Fix cfg block for Cygwin
1 parent a47744e commit fa1d7f7

1 file changed

Lines changed: 14 additions & 25 deletions

File tree

src/uu/stdbuf/src/stdbuf.rs

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,9 @@ mod options {
3131

3232
#[cfg(all(
3333
not(feature = "feat_external_libstdbuf"),
34-
any(
35-
target_os = "linux",
36-
target_os = "android",
37-
target_os = "freebsd",
38-
target_os = "netbsd",
39-
target_os = "openbsd",
40-
target_os = "dragonfly"
41-
)
34+
unix,
35+
not(target_vendor = "apple"),
36+
not(target_os = "cygwin")
4237
))]
4338
const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so"));
4439

@@ -82,14 +77,7 @@ enum ProgramOptionsError {
8277
ValueTooLarge(String),
8378
}
8479

85-
#[cfg(any(
86-
target_os = "linux",
87-
target_os = "android",
88-
target_os = "freebsd",
89-
target_os = "netbsd",
90-
target_os = "openbsd",
91-
target_os = "dragonfly"
92-
))]
80+
#[cfg(all(unix, not(target_vendor = "apple"), not(target_os = "cygwin")))]
9381
#[expect(
9482
clippy::unnecessary_wraps,
9583
reason = "fn sig must match on all platforms"
@@ -107,15 +95,16 @@ fn preload_strings() -> UResult<(&'static str, &'static str)> {
10795
Ok(("DYLD_LIBRARY_PATH", "dylib"))
10896
}
10997

110-
#[cfg(not(any(
111-
target_os = "linux",
112-
target_os = "android",
113-
target_os = "freebsd",
114-
target_os = "netbsd",
115-
target_os = "openbsd",
116-
target_os = "dragonfly",
117-
target_vendor = "apple"
118-
)))]
98+
#[cfg(target_os = "cygwin")]
99+
#[expect(
100+
clippy::unnecessary_wraps,
101+
reason = "fn sig must match on all platforms"
102+
)]
103+
fn preload_strings() -> UResult<(&'static str, &'static str)> {
104+
Ok(("LD_PRELOAD", "dll"))
105+
}
106+
107+
#[cfg(not(unix))]
119108
fn preload_strings() -> UResult<(&'static str, &'static str)> {
120109
Err(USimpleError::new(
121110
1,

0 commit comments

Comments
 (0)