don't drop lines without trailing new line character in wxExecute() with capture
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -151,6 +151,7 @@ wxX11:
|
|||||||
All:
|
All:
|
||||||
|
|
||||||
- Fix bug in wxFileConfig when recreating a group (Steven Van Ingelgem)
|
- Fix bug in wxFileConfig when recreating a group (Steven Van Ingelgem)
|
||||||
|
- Account for lines without newline at the end in wxExecute()
|
||||||
|
|
||||||
All (Unix):
|
All (Unix):
|
||||||
|
|
||||||
|
@@ -556,24 +556,27 @@ static bool ReadAll(wxInputStream *is, wxArrayString& output)
|
|||||||
|
|
||||||
wxTextInputStream tis(*is);
|
wxTextInputStream tis(*is);
|
||||||
|
|
||||||
bool cont = true;
|
for ( ;; )
|
||||||
while ( cont )
|
|
||||||
{
|
{
|
||||||
wxString line = tis.ReadLine();
|
wxString line = tis.ReadLine();
|
||||||
if ( is->Eof() )
|
|
||||||
break;
|
|
||||||
|
|
||||||
if ( !*is )
|
// check for EOF before other errors as it's not really an error
|
||||||
|
if ( is->Eof() )
|
||||||
{
|
{
|
||||||
cont = false;
|
// add the last, possibly incomplete, line
|
||||||
|
if ( !line.empty() )
|
||||||
|
output.Add(line);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// any other error is fatal
|
||||||
|
if ( !*is )
|
||||||
|
return false;
|
||||||
|
|
||||||
output.Add(line);
|
output.Add(line);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return cont;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // wxUSE_STREAMS
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user