[GRASS-SVN] r54556 - grass/trunk/lib/python/pygrass/modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 6 23:41:57 PST 2013


Author: zarch
Date: 2013-01-06 23:41:56 -0800 (Sun, 06 Jan 2013)
New Revision: 54556

Modified:
   grass/trunk/lib/python/pygrass/modules/__init__.py
Log:
stdin_ parameter now it's working

Modified: grass/trunk/lib/python/pygrass/modules/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/__init__.py	2013-01-07 07:41:44 UTC (rev 54555)
+++ grass/trunk/lib/python/pygrass/modules/__init__.py	2013-01-07 07:41:56 UTC (rev 54556)
@@ -587,12 +587,18 @@
 
     def run(self, node=None):
         cmd = self.make_cmd()
+        if self.stdin_:
+            self.stdin = self.stdin_
+            self.stdin_ = subprocess.PIPE
         self.popen = subprocess.Popen(cmd, stdin=self.stdin_,
                                       stdout=self.stdout_,
                                       stderr=self.stderr_)
-        if self.finish_:
-            self.popen.wait()
-        self.stdout, self.stderr = self.popen.communicate()
+        if self.stdin_:
+            self.stdout, self.stderr = self.popen.communicate(input=self.stdin)
+        else:
+            if self.finish_:
+                self.popen.wait()
+            self.stdout, self.stderr = self.popen.communicate()
 
 _CMDS = list(grass.script.core.get_commands()[0])
 _CMDS.sort()



More information about the grass-commit mailing list