From: Kyr Shatskyy Date: Tue, 22 Oct 2019 09:13:41 +0000 (+0200) Subject: misc: add cwd and env to sh X-Git-Tag: 1.1.0~203^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f14a4f7d01388af4f30fc65eb7ef8d71e824f439;p=teuthology.git misc: add cwd and env to sh Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 3472f8b56..1246d7040 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -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,