Skip to content

Commit

Permalink
fix(schedular server): parse port to number before passing it to Tcp
Browse files Browse the repository at this point in the history
  • Loading branch information
YassinEldeeb committed Apr 3, 2022
1 parent 3f4552c commit f246457
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion gui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 5 additions & 1 deletion schedular/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ use std::{
};

pub fn run_server(exit: Arc<Mutex<bool>>) {
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();
Expand Down
2 changes: 0 additions & 2 deletions schedular/src/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ pub fn bg_system_tray(exit: Arc<Mutex<bool>>) {
} 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);
Expand Down

1 comment on commit f246457

@vercel
Copy link

@vercel vercel bot commented on f246457 Apr 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.