mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2025-01-01 04:29:19 +00:00
stop reading at end-of-file.
This commit is contained in:
parent
dc76f5addf
commit
32bca0bad6
@ -2,6 +2,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <cerrno>
|
||||
#include <algorithm>
|
||||
|
||||
%%{
|
||||
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user