Skip to content

Commit

Permalink
backup: fixed job stdout polling logic to capture quick ones
Browse files Browse the repository at this point in the history
We now check for output at least once before checking the child process
existence.

Closes PortableApps#3.
  • Loading branch information
alex-ter committed Jun 19, 2016
1 parent afa8696 commit 1c89596
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backup/backupjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ void* BackupJob::Entry(){
event->SetInt(id);
event->SetString(commands.Item(i));
wxGetApp().QueueEvent(event);
while(wxGetApp().m_StatusMap[id] != true){
do {
if(!process->HasInput()){
//If there was no input then sleep for a while so we don't thrash the CPU
wxMilliSleep(100);
}
}
} while(wxGetApp().m_StatusMap[id] != true);

//Grab any remaining output
while(process->HasInput());
Expand Down

0 comments on commit 1c89596

Please sign in to comment.