@@ -2061,14 +2061,20 @@ QProcess *QgsGrass::startModule( const QString& gisdbase, const QString& locati
2061
2061
out.flush ();
2062
2062
QgsDebugMsg ( gisrcFile.fileName () );
2063
2063
gisrcFile.close ();
2064
- QStringList environment = QProcess::systemEnvironment ();
2065
- environment.append ( " GISRC=" + gisrcFile.fileName () );
2066
- environment.append ( " GRASS_MESSAGE_FORMAT=gui" );
2064
+ QProcessEnvironment environment = QProcessEnvironment::systemEnvironment ();
2065
+ QStringList paths = QgsGrass::grassModulesPaths ();
2066
+ // PYTHONPATH necessary for t.list.py
2067
+ // PATH necessary for g.parser called by t.list.py
2068
+ paths += environment.value ( " PATH" ).split ( QgsGrass::pathSeparator () );
2069
+ environment.insert ( " PATH" , paths.join ( QgsGrass::pathSeparator () ) );
2070
+ environment.insert ( " PYTHONPATH" , QgsGrass::getPythonPath () );
2071
+ environment.insert ( " GISRC" , gisrcFile.fileName () );
2072
+ environment.insert ( " GRASS_MESSAGE_FORMAT" , " gui" );
2067
2073
// Normaly modules must be run in a mapset owned by user, because each module calls G_gisinit()
2068
2074
// which checks if G_mapset() is owned by user. The check is disabled by GRASS_SKIP_MAPSET_OWNER_CHECK.
2069
- environment.append ( " GRASS_SKIP_MAPSET_OWNER_CHECK= 1" );
2075
+ environment.insert ( " GRASS_SKIP_MAPSET_OWNER_CHECK" , " 1" );
2070
2076
2071
- process->setEnvironment ( environment );
2077
+ process->setProcessEnvironment ( environment );
2072
2078
2073
2079
QgsDebugMsg ( modulePath + " " + arguments.join ( " " ) );
2074
2080
process->start ( modulePath, arguments );
0 commit comments