Fallback to pgrep if pidof is unavailable

This commit is contained in:
Luke Parker 2023-07-21 03:37:48 -04:00
parent 900298b94b
commit 37af8b51b3
No known key found for this signature in database

View file

@ -29,7 +29,16 @@ macro_rules! serai_test {
let guard = common::SEQUENTIAL.lock().await;
let is_running = || {
!Command::new("pidof").arg("serai-node").output().unwrap().stdout.is_empty()
!(
if let Ok(res) = Command::new("pidof").arg("serai-node").output() {
res
} else {
Command::new("pgrep")
.arg("serai-node")
.output()
.expect("neither pidof nor pgrep were available")
}
).stdout.is_empty()
};
// Spawn a fresh Serai node