From ee34b47bd8eb0573c7e69f2c5dba2ffd2ffd9093 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Thu, 23 Mar 2023 15:36:49 -0600 Subject: [PATCH] only stdout for output to std --- src/stream.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/stream.rs b/src/stream.rs index 68f1110..f5f2ab5 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -39,24 +39,24 @@ pub fn build_input_stream_device_gilrs(cfg: &Stream) -> Result Result { for device in api.devices() { - println!("{:#?}", device); + eprintln!("{:#?}", device); } }, Err(e) => { @@ -94,7 +94,7 @@ pub fn build_input_stream_device_rusb(cfg: &Stream) -> Result Result { let udp_cfg = cfg.engine.udp.as_ref().unwrap(); - println!("$ echo -n 'hello world' | nc -4u -w0 localhost {}", &udp_cfg.port.to_string()); + eprintln!("$ echo -n 'hello world' | nc -4u -w0 localhost {}", &udp_cfg.port.to_string()); return Ok(InputStreamUDP{ last_socket: None, port: udp_cfg.port, @@ -133,7 +133,7 @@ impl InputStream for InputStreamUDP { let mut buf = [0; 128]; let result = self.last_socket.as_ref().unwrap().recv_from(&mut buf); if result.is_err() { - println!("InputStreamUDP: failed to recv: {:?}", result.err()); + eprintln!("InputStreamUDP: failed to recv: {:?}", result.err()); self.last_socket = None; return Vec::::new(); } @@ -297,13 +297,13 @@ impl OutputStream for OutputStreamUDP { if self.last_socket.is_none() { let result = std::net::UdpSocket::bind("127.0.0.1:".to_string() + &(self.port+10).to_string()); if result.is_err() { - println!("OutputStreamUDP: failed to bind to 127.0.0.1:{}: {:?}", &(self.port+10).to_string(), result.err()); + eprintln!("OutputStreamUDP: failed to bind to 127.0.0.1:{}: {:?}", &(self.port+10).to_string(), result.err()); return; } self.last_socket = Some(result.unwrap()); let result = self.last_socket.as_ref().unwrap().connect(self.host.to_string() + ":" + &self.port.to_string()); if result.is_err() { - println!("OutputStreamUDP: failed to connect to {}:{}: {:?}", self.host.to_string(), self.port.to_string(), result.err()); + eprintln!("OutputStreamUDP: failed to connect to {}:{}: {:?}", self.host.to_string(), self.port.to_string(), result.err()); self.last_socket = None; return; } @@ -311,7 +311,7 @@ impl OutputStream for OutputStreamUDP { let result = self.last_socket.as_ref().unwrap().send(&v.iter().cloned().collect::().as_bytes()); if result.is_err() { - println!("OutputStreamUDP: failed to send: {:?}", result.err()); + eprintln!("OutputStreamUDP: failed to send: {:?}", result.err()); self.last_socket = None; } }