[GRASS-SVN] r57252 - grass/trunk/lib/python/pygrass/modules/interface
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 23 02:59:35 PDT 2013
Author: huhabla
Date: 2013-07-23 02:59:33 -0700 (Tue, 23 Jul 2013)
New Revision: 57252
Modified:
grass/trunk/lib/python/pygrass/modules/interface/module.py
Log:
Dont wait for the process to terminate in case finish_==False
Modified: grass/trunk/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/module.py 2013-07-22 21:15:47 UTC (rev 57251)
+++ grass/trunk/lib/python/pygrass/modules/interface/module.py 2013-07-23 09:59:33 UTC (rev 57252)
@@ -269,6 +269,16 @@
return args
def run(self, node=None):
+ """!Run the module
+
+ This function will wait for the process to terminate
+ in case finish_==True and sets up stdout and stderr.
+ If finish_==False this function will return after starting
+ the process. Use self.popen.communicate() of self.popen.wait()
+ to wait for the process termination. The handling
+ of stdout and stderr must then be done outside of this
+ function.
+ """
if self.inputs['stdin'].value:
self.stdin = self.inputs['stdin'].value
self.stdin_ = subprocess.PIPE
@@ -283,8 +293,6 @@
stderr=self.stderr_,
env=self.env_)
if self.finish_:
- self.popen.wait()
-
- stdout, stderr = self.popen.communicate(input=self.stdin)
- self.outputs['stdout'].value = stdout if stdout else ''
- self.outputs['stderr'].value = stderr if stderr else ''
+ stdout, stderr = self.popen.communicate(input=self.stdin)
+ self.outputs['stdout'].value = stdout if stdout else ''
+ self.outputs['stderr'].value = stderr if stderr else ''
More information about the grass-commit
mailing list