Skip to content

Commit

Permalink
Stop shell read loop if the input stream was closed (#36675)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq authored Dec 2, 2024
1 parent 5119977 commit e7b0989
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/shell/MainLoopDefault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ size_t ReadLine(char * buffer, size_t max)
break;
}

// Stop the loop if the input stream is closed.
if (ret == 0)
{
if (line_sz > 0)
// Return current buffer if it is not empty.
buffer[line_sz++] = '\0';
break;
}

if (ret != 1)
continue;

Expand Down

0 comments on commit e7b0989

Please sign in to comment.