Merge pull request #2234 from chadbrewbaker/fix-cat-random-timeout

dev random blocks on linux
This commit is contained in:
Sylvestre Ledru 2021-05-20 23:25:11 +02:00 committed by GitHub
commit b9e99543db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -347,7 +347,13 @@ fn test_squeeze_blank_before_numbering() {
#[cfg(unix)]
fn test_dev_random() {
let mut buf = [0; 2048];
let mut proc = new_ucmd!().args(&["/dev/random"]).run_no_wait();
#[cfg(target_os = "linux")]
const DEV_RANDOM: &str = "/dev/urandom";
#[cfg(not(target_os = "linux"))]
const DEV_RANDOM: &str = "/dev/random";
let mut proc = new_ucmd!().args(&[DEV_RANDOM]).run_no_wait();
let mut proc_stdout = proc.stdout.take().unwrap();
proc_stdout.read_exact(&mut buf).unwrap();