I'm not sure if I'm doing anything near the right thing here.
The problem I was trying to solve is that under Linux, I was getting a panic (EINTR) when I pressed ctrl-C. I was running the example code using cargo run --example channel_example. Expected behaviour was to receive the appropriate message on the channel and exit cleanly.
Looking at the code, it appears that the system signal is already handled later when you read from that pipe. So I changed it to not short circuit the error on the result, but to check whether it was a system error or one of the other nix errors before propagating upward.
Now when I run the channel_example example, it performs as expected under Linux instead of crashing with a panic.
Unit tests are still passing on Linux, but I haven't tested that it still works on MacOS or other Unixes.
I'm not sure if I'm doing anything near the right thing here.
The problem I was trying to solve is that under Linux, I was getting a panic (EINTR) when I pressed ctrl-C. I was running the example code using
cargo run --example channel_example
. Expected behaviour was to receive the appropriate message on the channel and exit cleanly.Looking at the code, it appears that the system signal is already handled later when you read from that pipe. So I changed it to not short circuit the error on the result, but to check whether it was a system error or one of the other nix errors before propagating upward.
Now when I run the channel_example example, it performs as expected under Linux instead of crashing with a panic.
Unit tests are still passing on Linux, but I haven't tested that it still works on MacOS or other Unixes.