]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
misc: add cwd and env to sh
authorKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Tue, 22 Oct 2019 09:13:41 +0000 (11:13 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Tue, 22 Oct 2019 09:13:41 +0000 (11:13 +0200)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/misc.py

index 3472f8b565334f7d01121fc93fef7112e2f00164..1246d704019749c6cb78caf71f6e961bef3a8096 100644 (file)
@@ -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,