From 32bca0bad64109f856de61b441220d53904dfe93 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Wed, 27 Jan 2016 13:18:27 -0500 Subject: [PATCH] stop reading at end-of-file. --- mpw-shell-read.rl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mpw-shell-read.rl b/mpw-shell-read.rl index 6003dde..bfcc657 100644 --- a/mpw-shell-read.rl +++ b/mpw-shell-read.rl @@ -2,6 +2,7 @@ #include #include +#include #include %%{ @@ -347,8 +348,10 @@ command_ptr read_fd(int fd) { for(;;) { ssize_t s = read(fd, buffer, sizeof(buffer)); if (s < 0) { + if (errno == EINTR) continue; throw std::runtime_error("MPW Shell - Read error."); } + if (s == 0) break; p.process(buffer, s); } return p.finish();