Skip to content

Commit ad132f3

Browse files
oech3cakebaker
authored andcommitted
stdbuf: Fix cfg block for Cygwin
1 parent a21177e commit ad132f3

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

src/uu/stdbuf/src/stdbuf.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,9 @@ mod options {
3333

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

@@ -84,14 +79,7 @@ enum ProgramOptionsError {
8479
ValueTooLarge(String),
8580
}
8681

87-
#[cfg(any(
88-
target_os = "linux",
89-
target_os = "android",
90-
target_os = "freebsd",
91-
target_os = "netbsd",
92-
target_os = "openbsd",
93-
target_os = "dragonfly"
94-
))]
82+
#[cfg(all(unix, not(target_vendor = "apple"), not(target_os = "cygwin")))]
9583
#[expect(
9684
clippy::unnecessary_wraps,
9785
reason = "fn sig must match on all platforms"
@@ -109,6 +97,15 @@ fn preload_strings() -> UResult<(&'static str, &'static str)> {
10997
Ok(("DYLD_LIBRARY_PATH", "dylib"))
11098
}
11199

100+
#[cfg(target_os = "cygwin")]
101+
#[expect(
102+
clippy::unnecessary_wraps,
103+
reason = "fn sig must match on all platforms"
104+
)]
105+
fn preload_strings() -> UResult<(&'static str, &'static str)> {
106+
Ok(("LD_PRELOAD", "dll"))
107+
}
108+
112109
fn check_option(matches: &ArgMatches, name: &str) -> Result<BufferType, ProgramOptionsError> {
113110
match matches.get_one::<String>(name) {
114111
Some(value) => match value.as_str() {

0 commit comments

Comments
 (0)