Skip to content

Commit bddb316

Browse files
author
rblazek
committed
description update to QProcess
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5118 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 069e8aa commit bddb316

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -294,24 +294,20 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions (
294294
mXName = xname;
295295
mParent = parent;
296296

297-
Q3Process *process = new Q3Process( this );
298-
process->addArgument( mXName );
299-
process->addArgument( "--interface-description" );
300-
301-
// Attention: if a binary has the .exe extention it must be
302-
// also in mXName but we cannot append it here because
303-
// the modules can also be a script => ???
304-
// For now create in GISBASE/bin copy of each module without
305-
// .exe extension
306-
if ( !process->start( ) ) {
297+
QProcess process( this );
298+
process.start ( mXName, QStringList ( "--interface-description") );
299+
300+
// ? Does binary on Win need .exe extention ?
301+
// Return code 255 (-1) was correct in GRASS < 6.1.0
302+
if ( !process.waitForFinished()
303+
|| (process.exitCode() != 0 && process.exitCode() != 255) )
304+
{
305+
std::cerr << "process.exitCode() = " << process.exitCode() << std::endl;
307306
QMessageBox::warning( 0, "Warning", "Cannot start module " + mXName );
308307
return;
309308
}
310-
while ( process->isRunning () ) { // TODO: check time, if it is not running too long
311-
}
312-
QByteArray gDescArray = process->readStdout();
313-
QByteArray errArray = process->readStderr();
314-
delete process;
309+
QByteArray gDescArray = process.readAllStandardOutput();
310+
QByteArray errArray = process.readAllStandardError();
315311

316312
QDomDocument gDoc ( "task" );
317313
QString err;

0 commit comments

Comments
 (0)