Selaa lähdekoodia

Add exec_command

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32855 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 16 vuotta sitten
vanhempi
commit
5dda38ec58
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  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):