From f24645779a7875ddd76df3df23de52e2b4df615c Mon Sep 17 00:00:00 2001 From: YassinEldeeb Date: Sun, 3 Apr 2022 14:48:37 +0200 Subject: [PATCH] fix(schedular server): parse port to number before passing it to Tcp --- gui/src/lib.rs | 1 - schedular/src/server.rs | 6 +++++- schedular/src/system_tray.rs | 2 -- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/src/lib.rs b/gui/src/lib.rs index 8551463..beb605b 100644 --- a/gui/src/lib.rs +++ b/gui/src/lib.rs @@ -170,7 +170,6 @@ fn save_inputs(conf: &DeadlinerConf) -> Result<(), String> { // !Here we setup a schedule to update the wallpaper let schedular_exec = format!("deadliner-schedular{}", &get_current_file_ext()); - println!("{:?}", new_path(&schedular_exec).to_str().unwrap()); unwrap_or_return!( Command::new(new_path(&schedular_exec)) .arg("skip-update-on-launch") diff --git a/schedular/src/server.rs b/schedular/src/server.rs index bef8e38..d053594 100644 --- a/schedular/src/server.rs +++ b/schedular/src/server.rs @@ -9,7 +9,11 @@ use std::{ }; pub fn run_server(exit: Arc>) { - let port = fs::read_to_string(new_path("port.txt")).unwrap(); + let port: u16 = fs::read_to_string(new_path("port.txt")) + .unwrap() + .trim() + .parse() + .unwrap(); let addr = format!("127.0.0.1:{}", port); let listener = TcpListener::bind(&addr).unwrap(); diff --git a/schedular/src/system_tray.rs b/schedular/src/system_tray.rs index 9e3123e..f5f7bdc 100644 --- a/schedular/src/system_tray.rs +++ b/schedular/src/system_tray.rs @@ -83,8 +83,6 @@ pub fn bg_system_tray(exit: Arc>) { } else { let gui_exec = format!("deadliner{}", &get_current_file_ext()); - println!("{:?}", new_path(&gui_exec).to_str().unwrap()); - let child_process = Command::new(new_path(&gui_exec)).spawn().unwrap(); *gui_handler = Some(child_process);