diff options
author | Joe Guo <joeg@catalyst.net.nz> | 2019-05-22 23:50:01 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-06-20 23:40:16 +0000 |
commit | 04a6967bc393e0305bac9f33a42cceb4eb88f20b (patch) | |
tree | 911189677518ca2dd4f5a1d23cae41f167748e30 /script | |
parent | 6fc3eb8926a1618c2acdf80f9b8d5cc213a90e4d (diff) | |
download | samba-04a6967bc393e0305bac9f33a42cceb4eb88f20b.tar.gz |
script/autobuild.py: define cwd for builder and avoid chdir
We can pass cwd in Popen, no need to chdir for each cmd.
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'script')
-rwxr-xr-x | script/autobuild.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/script/autobuild.py b/script/autobuild.py index b0d9f14a958..bb5ab4094d4 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -745,6 +745,7 @@ class builder(object): self.stderr = open(self.stderr_path, 'w') self.stdin = open("/dev/null", 'r') self.test_source_dir = "%s/%s" % (testbase, self.tag) + self.cwd = "%s/%s" % (self.test_source_dir, self.dir) self.prefix = "%s/%s" % (test_prefix, self.tag) run_cmd("rm -rf %s" % self.test_source_dir) run_cmd("rm -rf %s" % self.prefix) @@ -771,13 +772,10 @@ class builder(object): self.cmd = self.cmd.replace("${LOG_BASE}", options.log_base) self.cmd = self.cmd.replace("${NAME}", self.name) self.cmd = self.cmd.replace("${ENABLE_COVERAGE}", options.enable_coverage) - cwd = os.getcwd() - os.chdir("%s/%s" % (self.test_source_dir, self.dir)) - do_print('%s: [%s] Running %s in %r' % (self.name, self.stage, self.cmd, os.getcwd())) + do_print('%s: [%s] Running %s in %r' % (self.name, self.stage, self.cmd, self.cwd)) self.proc = Popen(self.cmd, shell=True, - close_fds=True, + close_fds=True, cwd=self.cwd, stdout=self.stdout, stderr=self.stderr, stdin=self.stdin) - os.chdir(cwd) self.next += 1 |