From 46a00e4d4e47a0c58268e45758cdec359a8d069a Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Fri, 10 Jun 2022 11:42:57 +0500 Subject: [PATCH] Ignore 141 error code Apparently it means process was terminated with SIGPIPE and we want to ignore this error because lf sends this signal when enough lines of input are read --- src/preview.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/preview.c b/src/preview.c index 16d191e..1213dce 100644 --- a/src/preview.c +++ b/src/preview.c @@ -8,6 +8,7 @@ #include "preview.h" #define FAILED_PREVIEW_EC NOTEXIST_EC +#define ENOUGH_READ_EC 141 #define PREVP_SIZE sizeof(Preview *) @@ -192,9 +193,13 @@ run: } ERRCHK_RET_OK(run(p, &exitcode)); - if (exitcode == FAILED_PREVIEW_EC) { + switch (exitcode) { + case FAILED_PREVIEW_EC: i++; goto run; + case ENOUGH_READ_EC: + exitcode = 0; + break; } return exitcode == 0 ? OK : ERR;