Skip to content

Commit 4560e85

Browse files
committed
clitools: Attempt to mitigate ETXTBSY some more
Somehow sometimes we still get ETXTBSY on Travis test suite runs This attempts to mitigate that a little more Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
1 parent 255dad7 commit 4560e85

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

tests/mock/clitools.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,27 @@ where
437437
}
438438

439439
println!("running {:?}", cmd);
440-
let lock = cmd_lock().read().unwrap();
441-
let out = cmd.output();
442-
drop(lock);
443-
let out = out.expect("failed to run test command");
440+
let mut retries = 8;
441+
let out = loop {
442+
let lock = cmd_lock().read().unwrap();
443+
let out = cmd.output();
444+
drop(lock);
445+
match out {
446+
Ok(out) => break out,
447+
Err(e) => {
448+
retries -= 1;
449+
if retries > 0
450+
&& e.kind() == std::io::ErrorKind::Other
451+
&& format!("{}", e).contains("os error 26")
452+
{
453+
// This is a ETXTBSY situation
454+
std::thread::sleep(std::time::Duration::from_millis(250));
455+
} else {
456+
panic!("Unable to run test command: {:?}", e);
457+
}
458+
}
459+
}
460+
};
444461

445462
let output = SanitizedOutput {
446463
ok: out.status.success(),

0 commit comments

Comments
 (0)