@@ -294,24 +294,20 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions (
294
294
mXName = xname;
295
295
mParent = parent;
296
296
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;
307
306
QMessageBox::warning ( 0 , " Warning" , " Cannot start module " + mXName );
308
307
return ;
309
308
}
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 ();
315
311
316
312
QDomDocument gDoc ( " task" );
317
313
QString err;
0 commit comments