outputfile and i3blocks command via argument

This commit is contained in:
teldra 2019-08-26 04:41:46 +02:00
parent a6a9598126
commit daa53a059d
1 changed files with 11 additions and 6 deletions

View File

@ -296,14 +296,19 @@ fn main() {
for (i, num_unseen) in rx { for (i, num_unseen) in rx {
unseen[i] = num_unseen; 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( file.write_all(num_unseen.to_string().as_bytes()).expect(
"write failed", "write failed",
); );
Command::new("pkill") Command::new("sh").arg("-c").arg(&commands).spawn().expect(
.arg("-RTMIN+2") "command failed to start",
.arg("i3blocks") );
.spawn() // Command::new("pkill")
.expect("pkill command failed to start"); // .arg("-RTMIN+2")
// .arg("i3blocks")
// .spawn()
// .expect("pkill command failed to start");
} }
} }