浏览代码

Add exec_command

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32855 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 17 年之前
父节点
当前提交
5dda38ec58
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      lib/python/grass.py

+ 6 - 0
lib/python/grass.py

@@ -58,6 +58,12 @@ def read_command(*args, **kwargs):
     ps = pipe_command(*args, **kwargs)
     return ps.communicate()[0]
 
+def exec_command(prog, flags = "", overwrite = False, quiet = False, verbose = False, env = None, **kwargs):
+    args = make_command(prog, flags, overwrite, quiet, verbose, **kwargs)
+    if env == None:
+	env = os.environ
+    os.execvpe(prog, args, env)
+
 # interface to g.message
 
 def message(msg, flag = None):