misc: add cwd and env to sh
@@ -1289,7 +1289,7 @@ def is_in_dict(searchkey, searchval, d):
return searchval == val
-def sh(command, log_limit=1024):
+def sh(command, log_limit=1024, cwd=None, env=None):
"""
Run the shell command and return the output in ascii (stderr and
stdout). If the command fails, raise an exception. The command
@@ -1298,6 +1298,8 @@ def sh(command, log_limit=1024):
log.debug(":sh: " + command)
proc = subprocess.Popen(
args=command,
+ cwd=cwd,
+ env=env,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True,
