You've already forked pgbackrest
							
							
				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:
		| @@ -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(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user