fix(tests): use cat instead of true in wlcopy test to avoid EPIPE
The wlcopy_helper_succeeds_when_binary_returns_zero test used `true` as a stand-in for wl-copy, but `true` exits immediately without reading stdin. On Linux CI runners the process exits before the parent can write to the pipe, producing EPIPE and failing the is_ok() assertion. Switch to `cat` which reads stdin until EOF (when the pipe is closed) and then exits 0, faithfully modelling a successful wl-copy invocation.
This commit is contained in:
@@ -442,7 +442,12 @@ mod tests {
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn wlcopy_helper_succeeds_when_binary_returns_zero() {
|
||||
let result = write_text_with_wlcopy_using_argv("true", "test");
|
||||
// Use `cat` instead of `true` because `true` exits immediately
|
||||
// without reading stdin, causing EPIPE before we can check the
|
||||
// exit status. `cat` consumes stdin until EOF (when we drop the
|
||||
// pipe) and then exits 0, faithfully modelling a successful
|
||||
// wl-copy invocation.
|
||||
let result = write_text_with_wlcopy_using_argv("cat", "test");
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user