Skip to content

Commit

Permalink
Fixed error in linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
robdobsn committed Feb 13, 2024
1 parent 8ae4394 commit b0804ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/serial_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,10 @@ pub async fn start(port: String, baud: u32, log: bool, log_folder: String) -> to
#[cfg(not(unix))]
let serial_port = tokio_serial::new(&port, baud).open_native_async();

// Open serial port and set to non-exclusive mode on Unix
// // Open serial port and set to non-exclusive mode on Unix
#[cfg(unix)]
let mut serial_port = tokio_serial::new(&port, baud).open_native_async();
let serial_port = tokio_serial::new(&port, baud).open_native_async();

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

// Handle errors in opening the serial port
let serial_port = match serial_port {
Ok(serial_port) => serial_port,
Expand All @@ -163,6 +160,9 @@ pub async fn start(port: String, baud: u32, log: bool, log_folder: String) -> to
}
};

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

Check failure on line 164 in src/serial_monitor.rs

View workflow job for this annotation

GitHub Actions / Build and release for macos-latest

cannot borrow `serial_port` as mutable, as it is not declared as mutable

// Create a stream from the serial port
let stream = LineCodec.framed(serial_port);
let (mut serial_tx, mut serial_rx) = stream.split();
Expand Down

0 comments on commit b0804ff

Please sign in to comment.