diff options
| author | Eskil Queseth <eskilq@kth.se> | 2021-03-26 01:15:55 +0100 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2021-03-26 01:15:55 +0100 |
| commit | 5cc61e8d2140280421b5962b2911ebbcc927e9d1 (patch) | |
| tree | 4826ead4ec8cc5e920f263225c78558f449f650c /mumctl/src/main.rs | |
| parent | 169eb4f49f3fd587e9c28f2209b2dd130425d866 (diff) | |
| download | mum-5cc61e8d2140280421b5962b2911ebbcc927e9d1.tar.gz | |
re-add error checking
Diffstat (limited to 'mumctl/src/main.rs')
| -rw-r--r-- | mumctl/src/main.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index 3cbbcf7..123f5cd 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -615,15 +615,15 @@ fn parse_status(server_state: &mumlib::state::Server) { } fn send_command(command: Command) -> Result<mumlib::error::Result<Option<CommandResponse>>, crate::Error> { - let mut connection = UnixStream::connect("/tmp/mumd").unwrap(); + let mut connection = UnixStream::connect("/tmp/mumd").map_err(|_| Error::ConnectionError)?; let serialized = bincode::serialize(&command).unwrap(); - connection.write(&(serialized.len() as u32).to_be_bytes()).unwrap(); - connection.write(&serialized).unwrap(); + connection.write(&(serialized.len() as u32).to_be_bytes()).map_err(|_| Error::ConnectionError)?; + connection.write(&serialized).map_err(|_| Error::ConnectionError)?; - connection.read_exact(&mut [0; 4]).unwrap(); - let response = bincode::deserialize_from(&mut connection).unwrap(); + connection.read_exact(&mut [0; 4]).map_err(|_| Error::ConnectionError)?; + let response = bincode::deserialize_from(&mut connection).map_err(|_| Error::ConnectionError)?; Ok(response) } |
