Skip to content

Commit e7b0989

Browse files
authored
Stop shell read loop if the input stream was closed (#36675)
1 parent 5119977 commit e7b0989

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib/shell/MainLoopDefault.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ size_t ReadLine(char * buffer, size_t max)
5757
break;
5858
}
5959

60+
// Stop the loop if the input stream is closed.
61+
if (ret == 0)
62+
{
63+
if (line_sz > 0)
64+
// Return current buffer if it is not empty.
65+
buffer[line_sz++] = '\0';
66+
break;
67+
}
68+
6069
if (ret != 1)
6170
continue;
6271

0 commit comments

Comments
 (0)