Compare commits
No commits in common. "d1adc6baf0c2d92f2674b09395b1127abdabc281" and "ccf474922efbabfb630071b596fc1083a10197fb" have entirely different histories.
d1adc6baf0
...
ccf474922e
17
src/main.rs
17
src/main.rs
|
|
@ -6,6 +6,7 @@ mod utils;
|
|||
mod services;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
use std::process::Command;
|
||||
use std::sync::Arc;
|
||||
use std::io::Write;
|
||||
use chrono::Local;
|
||||
|
|
@ -15,6 +16,8 @@ use structs::*;
|
|||
use config::*;
|
||||
use utils::*;
|
||||
|
||||
static GET_ID_CMD : &'static str = "cat /proc/self/mountinfo | grep '/docker/containers/' | head -1 | awk -F '/' '{print $6}'";
|
||||
|
||||
|
||||
#[tokio::main(flavor = "multi_thread")]
|
||||
async fn main() {
|
||||
|
|
@ -74,4 +77,16 @@ async fn main() {
|
|||
i.await.unwrap();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// todo: cmd across cat /proc/self/mountinfo | grep "/docker/containers/" | head -1 | awk -F '/' '{print $5}'
|
||||
fn get_container_id() -> Option<String> {
|
||||
match Command::new(GET_ID_CMD).output() {
|
||||
Ok(output) => {
|
||||
Some(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
},
|
||||
Err(_) => {
|
||||
None
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
src/utils.rs
16
src/utils.rs
|
|
@ -2,7 +2,6 @@ use std::sync::Arc;
|
|||
use crate::structs::TrackingProcess;
|
||||
use tokio::sync::mpsc;
|
||||
use inotify::Inotify;
|
||||
use std::process::Command;
|
||||
use crate::files::create_watcher;
|
||||
use log::{error, warn};
|
||||
use crate::prcs::{
|
||||
|
|
@ -19,8 +18,6 @@ use tokio::join;
|
|||
use crate::files::file_handler;
|
||||
use crate::services::service_handler;
|
||||
|
||||
static GET_ID_CMD : &'static str = r"cat /proc/self/mountinfo | grep '/docker/containers/' | head -1 | awk -F '/' '{print \$6}'";
|
||||
|
||||
/// # async func to run 3 main daemons (now its more like tree-form than classiacl 0.1.0 form )
|
||||
/// > hint : give mpsc with capacity 1 to jump over potential errors during running process
|
||||
/// ** in [developing](https://github.com/prplV/runner-rs "REPOSITORY") **
|
||||
|
|
@ -160,16 +157,3 @@ pub async fn running_handler
|
|||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
tokio::task::yield_now().await;
|
||||
}
|
||||
|
||||
|
||||
// todo: cmd across cat /proc/self/mountinfo | grep "/docker/containers/" | head -1 | awk -F '/' '{print $5}'
|
||||
pub fn get_container_id() -> Option<String> {
|
||||
match Command::new("sh -c").arg(GET_ID_CMD).output() {
|
||||
Ok(output) => {
|
||||
Some(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
},
|
||||
Err(_) => {
|
||||
None
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue