[GRASS-SVN] r51418 - in
grass/branches/releasebranch_6_4/gui/wxpython: core gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 13 13:22:22 EDT 2012
Author: martinl
Date: 2012-04-13 10:22:21 -0700 (Fri, 13 Apr 2012)
New Revision: 51418
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_core/goutput.py
Log:
wxGUI: RunCmd() use copy of environ dict
(merge r51417 from devbr6)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py 2012-04-13 17:11:55 UTC (rev 51417)
+++ grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py 2012-04-13 17:22:21 UTC (rev 51418)
@@ -479,10 +479,11 @@
class CommandThread(Thread):
"""!Create separate thread for command. Used for commands launched
on the background."""
- def __init__ (self, cmd, stdin = None,
+ def __init__ (self, cmd, env = None, stdin = None,
stdout = sys.stdout, stderr = sys.stderr):
"""
@param cmd command (given as list)
+ @param env environmental variables
@param stdin standard input stream
@param stdout redirect standard output or None
@param stderr redirect standard error output or None
@@ -493,6 +494,7 @@
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
+ self.env = env
self.module = None
self.error = ''
@@ -532,7 +534,9 @@
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
- shell = sys.platform == "win32")
+ shell = sys.platform == "win32",
+ env = self.env)
+
except OSError, e:
self.error = str(e)
print >> sys.stderr, e
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_core/goutput.py 2012-04-13 17:11:55 UTC (rev 51417)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_core/goutput.py 2012-04-13 17:22:21 UTC (rev 51418)
@@ -52,9 +52,9 @@
wxCmdAbort, EVT_CMD_ABORT = NewEvent()
wxCmdPrepare, EVT_CMD_PREPARE = NewEvent()
-def GrassCmd(cmd, stdout = None, stderr = None):
+def GrassCmd(cmd, env = None, stdout = None, stderr = None):
"""!Return GRASS command thread"""
- return CommandThread(cmd,
+ return CommandThread(cmd, env = env,
stdout = stdout, stderr = stderr)
class CmdThread(threading.Thread):
@@ -575,7 +575,8 @@
# process GRASS command with argument
self.cmdThread.RunCmd(command, stdout = self.cmdStdOut, stderr = self.cmdStdErr,
- onDone = onDone, onPrepare = onPrepare, userData = userData)
+ onDone = onDone, onPrepare = onPrepare, userData = userData,
+ env = os.environ.copy())
self.cmdOutputTimer.Start(50)
# deactivate computational region and return to display settings
More information about the grass-commit
mailing list