Pi66

pino-rs
Rust notification daemon.
git clone https://git.pi66.xyz/pino-rs

← back to log

remove the bloated useless is_running function

author: pixel
date: 2025-05-03 13:09
hash: 087a6d955bf0f41ac8babd025b329ca9e94426db

Diffstat:

M

src/main.rs
6 +++------

D

src/utils.rs
20 ------------------------------
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
diff --git a/src/main.rs b/src/main.rs
index 756adb7..f15789c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,12 +2,10 @@ use argh::FromArgs;
 use fltk::app::screen_xywh;
 use serde::Deserialize;
 use std::{fs, io::Write, os::unix::net::UnixStream, path::Path};
-use utils::is_running;

 mod colors;
 mod config;
 mod ui;
-mod utils;

 #[derive(FromArgs)]
 #[argh(
@@ -135,8 +133,8 @@ fn main() {
     let config_content = fs::read_to_string(config_file).expect("Faild ");
     let config: Config = toml::from_str(&config_content).expect("Faild");

-    if Path::new("/tmp/pino-check.sock").exists() && is_running() {
-        let mut stream = UnixStream::connect("/tmp/pino-check.sock").unwrap();
+
+    if let Ok(mut stream) = UnixStream::connect("/tmp/pino-check.sock") {
         stream
             .write_all(
                 format!(
diff --git a/src/utils.rs b/src/utils.rs
deleted file mode 100644
index 698a237..0000000
--- a/src/utils.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use std::process::{Command, Stdio};
-
-pub fn is_running() -> bool {
-    let output = Command::new("pgrep")
-        .arg("-x")
-        .arg("pino")
-        .stdout(Stdio::piped())
-        .stderr(Stdio::null())
-        .output();
-
-    match output {
-        Ok(output) if output.status.success() => {
-            let pids = String::from_utf8_lossy(&output.stdout);
-
-            pids.lines().count() == 2
-        }
-
-        _ => false,
-    }
-}