chore: cargo and comments

master
blob42 2 weeks ago
parent 589ef486cd
commit f0b1791c18

@ -5,9 +5,9 @@ edition = "2021"
default-run = "pswatch" default-run = "pswatch"
[[bin]] [[example]]
name = "condition" name = "condition"
path = "src/bin/proto_condition.rs" path = "examples/proto_condition.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

@ -10,17 +10,10 @@ pub struct Profile {
/// pattern of process name to match against /// pattern of process name to match against
pub matching: ProcessMatcher, pub matching: ProcessMatcher,
// /// Where to match the process pattern (exe, cmdline, name)
// #[serde(default)]
// pub pattern_in: PatternIn, // pub pattern_in: PatternIn,
/// List of commands to run when condition is met /// List of commands to run when condition is met
pub commands: Vec<CmdSchedule>, pub commands: Vec<CmdSchedule>,
/// Interpret `pattern` as regex
// #[serde(default)]
// pub regex: bool,
//TODO: //TODO:
// pub match_by: // pub match_by:
/// process watch sampling rate /// process watch sampling rate

@ -44,10 +44,12 @@ impl ProfileJob<Process> {
fn run_cmd(cmd: &mut CmdSchedule, matching: ProcessMatcher, exec_end: bool) { fn run_cmd(cmd: &mut CmdSchedule, matching: ProcessMatcher, exec_end: bool) {
// handle end exec
let out = if exec_end && cmd.exec_end.is_some() { let out = if exec_end && cmd.exec_end.is_some() {
Command::new(&cmd.exec_end.as_ref().unwrap()[0]).args(&cmd.exec_end.as_ref().unwrap()[1..]).output() Command::new(&cmd.exec_end.as_ref().unwrap()[0]).args(&cmd.exec_end.as_ref().unwrap()[1..]).output()
} else if exec_end && cmd.exec_end.is_none() { } else if exec_end && cmd.exec_end.is_none() {
return; return;
// run normal execs
} else { } else {
Command::new(&cmd.exec[0]).args(&cmd.exec[1..]).output() Command::new(&cmd.exec[0]).args(&cmd.exec[1..]).output()
}; };

Loading…
Cancel
Save