Skip to content

Commit b7a709c

Browse files
committed
Read on closed pipe must return 0
1 parent ba3987e commit b7a709c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/shell_file_system.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ void ShellFileSystem::Reset(FileHandle &handle) {
8888

8989
int64_t ShellFileSystem::Read(FileHandle &handle, void *buffer, int64_t nr_bytes) {
9090
FILE *pipe = handle.Cast<ShellFileHandle>().pipe;
91+
92+
if (!pipe) {
93+
return 0;
94+
}
95+
9196
int64_t bytes_read = fread(buffer, 1, nr_bytes, pipe);
9297
if (bytes_read == -1)
9398
{

0 commit comments

Comments
 (0)