Skip to content

Commit b0804ff

Browse files
committed
Fixed error in linux build
1 parent 8ae4394 commit b0804ff

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/serial_monitor.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,10 @@ pub async fn start(port: String, baud: u32, log: bool, log_folder: String) -> to
140140
#[cfg(not(unix))]
141141
let serial_port = tokio_serial::new(&port, baud).open_native_async();
142142

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

147-
#[cfg(unix)]
148-
serial_port.set_exclusive(false).expect("Failed to set port non-exclusive");
149-
150147
// Handle errors in opening the serial port
151148
let serial_port = match serial_port {
152149
Ok(serial_port) => serial_port,
@@ -163,6 +160,9 @@ pub async fn start(port: String, baud: u32, log: bool, log_folder: String) -> to
163160
}
164161
};
165162

163+
#[cfg(unix)]
164+
serial_port.set_exclusive(false).expect("Failed to set port non-exclusive");
165+
166166
// Create a stream from the serial port
167167
let stream = LineCodec.framed(serial_port);
168168
let (mut serial_tx, mut serial_rx) = stream.split();

0 commit comments

Comments
 (0)