]> Repositorios git - scryer-prolog.git/commitdiff
do not unwrap stream write, TcpStream::shutdown results (#492)
authorMark Thom <[email protected]>
Wed, 13 May 2020 00:51:34 +0000 (18:51 -0600)
committerMark Thom <[email protected]>
Wed, 13 May 2020 00:51:42 +0000 (18:51 -0600)
src/prolog/machine/streams.rs
src/prolog/machine/system_calls.rs

index 84abb488d16806cc926eb0f00bcc4b2ea2db9f81..9e6ea491639ccd41d840172aa6590ad54d2ff0f5 100644 (file)
@@ -107,7 +107,7 @@ impl Drop for StreamInstance {
     fn drop(&mut self) {
         match self {
             StreamInstance::TcpStream(_, ref mut tcp_stream) => {
-                tcp_stream.shutdown(Shutdown::Both).unwrap();
+                discard_result!(tcp_stream.shutdown(Shutdown::Both));
             }
             _ => {
             }
index 86f32fcbb37368f638b44f18d0d7d72adc07298e..6ba358375579b48fc08db1e0c8870e2ca2572cc5 100644 (file)
@@ -2065,13 +2065,13 @@ impl MachineState {
                         match Number::try_from((addr, &self.heap)) {
                             Ok(Number::Integer(n)) => {
                                 if let Some(nb) = n.to_u8() {
-                                    stream.write(&mut [nb]).unwrap();
+                                    discard_result!(stream.write(&mut [nb]));
                                     return return_from_clause!(self.last_call, self);
                                 }
                             }
                             Ok(Number::Fixnum(n)) => {
                                 if let Ok(nb) = u8::try_from(n) {
-                                    stream.write(&mut [nb]).unwrap();
+                                    discard_result!(stream.write(&mut [nb]));
                                     return return_from_clause!(self.last_call, self);
                                 }
                             }