Browse Source

Check if `iox-roudi` process is running

tags/v0.0.0-test-pr-120
Philipp Oppermann 3 years ago
parent
commit
aec8643366
Failed to extract signature
3 changed files with 42 additions and 4 deletions
  1. +27
    -2
      Cargo.lock
  2. +1
    -0
      binaries/cli/Cargo.toml
  3. +14
    -2
      binaries/cli/src/check.rs

+ 27
- 2
Cargo.lock View File

@@ -891,6 +891,7 @@ dependencies = [
"eyre",
"serde_json",
"serde_yaml 0.9.11",
"sysinfo 0.26.6",
"tempfile",
"termcolor",
"uuid 1.2.1",
@@ -2198,6 +2199,15 @@ dependencies = [
"winapi",
]

[[package]]
name = "ntapi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc"
dependencies = [
"winapi",
]

[[package]]
name = "num-bigint-dig"
version = "0.7.0"
@@ -2432,7 +2442,7 @@ checksum = "a848fb2d43cc8e5adabdedc6b37a88b45653d3a23b000a3d047e6953d5af42ea"
dependencies = [
"indexmap",
"opentelemetry",
"sysinfo",
"sysinfo 0.24.5",
]

[[package]]
@@ -3631,7 +3641,22 @@ dependencies = [
"cfg-if",
"core-foundation-sys",
"libc",
"ntapi",
"ntapi 0.3.7",
"once_cell",
"rayon",
"winapi",
]

[[package]]
name = "sysinfo"
version = "0.26.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6d0dedf2e65d25b365c588382be9dc3a3ee4b0ed792366cf722d174c359d948"
dependencies = [
"cfg-if",
"core-foundation-sys",
"libc",
"ntapi 0.4.0",
"once_cell",
"rayon",
"winapi",


+ 1
- 0
binaries/cli/Cargo.toml View File

@@ -21,3 +21,4 @@ serde_json = "1.0.86"
termcolor = "1.1.3"
atty = "0.2.14"
uuid = { version = "1.2.1", features = ["v4"] }
sysinfo = "0.26.6"

+ 14
- 2
binaries/cli/src/check.rs View File

@@ -7,6 +7,7 @@ use dora_core::{
};
use eyre::{bail, eyre, Context};
use std::{env::consts::EXE_EXTENSION, io::Write, path::Path};
use sysinfo::SystemExt;
use termcolor::{Color, ColorChoice, ColorSpec, WriteColor};
use zenoh::{prelude::Receiver, sync::ZFuture};

@@ -43,8 +44,19 @@ pub fn check_environment() -> eyre::Result<()> {
let _ = stdout.reset();

// check whether roudi is running
// TODO, blocked on https://github.com/eclipse-iceoryx/iceoryx-rs/issues/62

write!(stdout, "Iceoryx Daemon: ")?;
let system = sysinfo::System::new_all();
match system.processes_by_exact_name("iox-roudi").next() {
Some(_) => {
let _ = stdout.set_color(ColorSpec::new().set_fg(Some(Color::Green)));
writeln!(stdout, "ok")?;
}
None => {
let _ = stdout.set_color(ColorSpec::new().set_fg(Some(Color::Red)));
writeln!(stdout, "not running")?;
error_occured = true;
}
}
writeln!(stdout)?;

if error_occured {


Loading…
Cancel
Save