mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-11 17:06:25 +00:00
Fallback to pgrep if pidof is unavailable
This commit is contained in:
parent
900298b94b
commit
37af8b51b3
1 changed files with 10 additions and 1 deletions
|
@ -29,7 +29,16 @@ macro_rules! serai_test {
|
||||||
let guard = common::SEQUENTIAL.lock().await;
|
let guard = common::SEQUENTIAL.lock().await;
|
||||||
|
|
||||||
let is_running = || {
|
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
|
// Spawn a fresh Serai node
|
||||||
|
|
Loading…
Reference in a new issue