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
This commit is contained in:
Nikita Ivanov 2022-06-10 11:42:57 +05:00
parent f0204c359e
commit 46a00e4d4e
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133

View File

@ -8,6 +8,7 @@
#include "preview.h" #include "preview.h"
#define FAILED_PREVIEW_EC NOTEXIST_EC #define FAILED_PREVIEW_EC NOTEXIST_EC
#define ENOUGH_READ_EC 141
#define PREVP_SIZE sizeof(Preview *) #define PREVP_SIZE sizeof(Preview *)
@ -192,9 +193,13 @@ run:
} }
ERRCHK_RET_OK(run(p, &exitcode)); ERRCHK_RET_OK(run(p, &exitcode));
if (exitcode == FAILED_PREVIEW_EC) { switch (exitcode) {
case FAILED_PREVIEW_EC:
i++; i++;
goto run; goto run;
case ENOUGH_READ_EC:
exitcode = 0;
break;
} }
return exitcode == 0 ? OK : ERR; return exitcode == 0 ? OK : ERR;