Skip to content

Commit

Permalink
conditional waitpid() for WIN
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@5200 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 6, 2006
1 parent ec14441 commit ddea8a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/plugins/grass/qgsgrassshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,22 @@ QgsGrassShell::~QgsGrassShell()
// TODO: find signal to write history before exit
// instead of sending 'exit'

int ret = write( mFdMaster, "exit\015\012", 6);
int status;
write( mFdMaster, "exit\015\012", 6);

#ifndef WIN32
while ( 1 )
{
readStdout(0);

int status;
if ( waitpid ( mPid, &status, WNOHANG ) > 0 ) break;

struct timespec t, r;
t.tv_sec = 0;
t.tv_nsec = 10000000; // 0.01 s
nanosleep ( &t, &r );
}
#endif

/*
std::cerr << "kill shell pid = " << mPid << std::endl;
Expand Down

0 comments on commit ddea8a1

Please sign in to comment.