Skip to content

Commit

Permalink
Fixed mutablility problem
Browse files Browse the repository at this point in the history
  • Loading branch information
robdobsn committed Feb 13, 2024
1 parent a69fcc7 commit d704831
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/serial_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ pub async fn start(port: String, baud: u32, log: bool, log_folder: String) -> to

// Handle errors in opening the serial port
let serial_port = match serial_port {
#[cfg(not(unix))]
Ok(serial_port) => serial_port,
#[cfg(unix)]
Ok(mut serial_port) => serial_port,
Err(err) => {
match err.kind() {
tokio_serial::ErrorKind::NoDevice => {
Expand All @@ -158,6 +155,8 @@ pub async fn start(port: String, baud: u32, log: bool, log_folder: String) -> to
}
};

#[cfg(unix)]
let mut serial_port = serial_port;
#[cfg(unix)]
serial_port.set_exclusive(false).expect("Failed to set port non-exclusive");

Expand Down

0 comments on commit d704831

Please sign in to comment.