浏览代码

pygrass: decode only if stdout/stderr not empty

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74496 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 6 年之前
父节点
当前提交
ec44b8432e
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      lib/python/pygrass/modules/interface/module.py

+ 2 - 4
lib/python/pygrass/modules/interface/module.py

@@ -782,10 +782,8 @@ class Module(object):
             if self.stdin:
                 self.stdin = encode(self.stdin)
             stdout, stderr = self.popen.communicate(input=self.stdin)
-            stdout = decode(stdout)
-            stderr = decode(stderr)
-            self.outputs['stdout'].value = stdout if stdout else ''
-            self.outputs['stderr'].value = stderr if stderr else ''
+            self.outputs['stdout'].value = decode(stdout) if stdout else ''
+            self.outputs['stderr'].value = decode(stderr) if stderr else ''
             self.time = time.time() - self.start_time
 
             self._finished = True