From daa53a059daf0d57dd6dbb05b7cbd20528903b93 Mon Sep 17 00:00:00 2001 From: teldra Date: Mon, 26 Aug 2019 04:41:46 +0200 Subject: [PATCH] outputfile and i3blocks command via argument --- src/main.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 063917d..adc6154 100644 --- a/src/main.rs +++ b/src/main.rs @@ -296,14 +296,19 @@ fn main() { for (i, num_unseen) in rx { unseen[i] = num_unseen; - let mut file = std::fs::File::create("/tmp/mails").expect("create failed"); + let output_path = ::std::env::args().nth(1).unwrap(); + let commands = ::std::env::args().nth(2).unwrap(); + let mut file = std::fs::File::create(&output_path).expect("create failed"); file.write_all(num_unseen.to_string().as_bytes()).expect( "write failed", ); - Command::new("pkill") - .arg("-RTMIN+2") - .arg("i3blocks") - .spawn() - .expect("pkill command failed to start"); + Command::new("sh").arg("-c").arg(&commands).spawn().expect( + "command failed to start", + ); + // Command::new("pkill") + // .arg("-RTMIN+2") + // .arg("i3blocks") + // .spawn() + // .expect("pkill command failed to start"); } }