1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Ignore write errors when the ls command is writing to stdout.

It's possible (even likely) that the ls output is being piped to something like head which will exit when it gets what it needs and leave us writing to a broken pipe.

It would be better to just ignore the broken pipe error but currently we don't store system error codes.
This commit is contained in:
David Steele
2019-09-17 21:04:38 -04:00
parent 8675699d08
commit ce1c7b0252

View File

@@ -171,8 +171,18 @@ cmdStorageList(void)
MEM_CONTEXT_TEMP_BEGIN()
{
storageListRender(ioHandleWriteNew(STRDEF("stdout"), STDOUT_FILENO));
ioHandleWriteOneStr(STDOUT_FILENO, LF_STR);
TRY_BEGIN()
{
storageListRender(ioHandleWriteNew(STRDEF("stdout"), STDOUT_FILENO));
ioHandleWriteOneStr(STDOUT_FILENO, LF_STR);
}
// Ignore write errors because it's possible (even likely) that this output is being piped to something like head which
// will exit when it gets what it needs and leave us writing to a broken pipe. It would be better to just ignore the broken
// pipe error but currently we don't store system error codes.
CATCH(FileWriteError)
{
}
TRY_END();
}
MEM_CONTEXT_TEMP_END();