pgbackrest.git / summary / log / commit / refs

commit    ce1c7b02520f2e37dfcfb283471fb4ec263b5d50
Author:   David Steele <david@pgmasters.net>
Date:     Wed Sep 18 01:04:38 2019 +0000

    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.


src/command/storage/list.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/command/storage/list.c b/src/command/storage/list.c index 248746173..7e6f7af2e 100644 --- a/src/command/storage/list.c +++ b/src/command/storage/list.c @@ -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(); [parent: 8675699d08b9]