From d229e5ee545f05b9e3638a9f9147f2d858291850 Mon Sep 17 00:00:00 2001 From: Suguivy Date: Sun, 5 Mar 2023 23:55:06 +0100 Subject: [PATCH] threadnig fix --- src/main.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 61d82da..fb10d87 100644 --- a/src/main.rs +++ b/src/main.rs @@ -103,39 +103,46 @@ fn verify_mode() { } fn pull() { - Command::new("scp") + let mut c1 = Command::new("scp") .arg("bot:/home/bot/sleepinggaysbot/urls.csv") .arg("verified.csv") .spawn() .expect("open command failed to start"); - Command::new("scp") + let mut c2 = Command::new("scp") .arg("bot:/home/bot/sleepinggaysbot/rejected.csv") .arg("rejected.csv") .spawn() .expect("open command failed to start"); - Command::new("scp") + let mut c3 = Command::new("scp") .arg("bot:/home/bot/sleepinggaysbot/pending.csv") .arg("pending.csv") .spawn() .expect("open command failed to start"); + c1.wait().unwrap(); + c2.wait().unwrap(); + c3.wait().unwrap(); + } fn push() { - Command::new("scp") + let mut c1 = Command::new("scp") .arg("verified.csv") .arg("bot:/home/bot/sleepinggaysbot/urls.csv") .spawn() .expect("open command failed to start"); - Command::new("scp") + let mut c2 = Command::new("scp") .arg("rejected.csv") .arg("bot:/home/bot/sleepinggaysbot/rejected.csv") .spawn() .expect("open command failed to start"); - Command::new("scp") + let mut c3 = Command::new("scp") .arg("pending.csv") .arg("bot:/home/bot/sleepinggaysbot/pending.csv") .spawn() .expect("open command failed to start"); + c1.wait().unwrap(); + c2.wait().unwrap(); + c3.wait().unwrap(); } fn input_parse(image_uri: &str) -> bool {