diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-12-25 13:46:35 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-12-25 13:49:37 +0100 |
commit | 0b12484dc9c100d76908a0c927b34374cbaec534 (patch) | |
tree | 89c5d35d8d01b63755521374ff83a2415f646395 | |
parent | 943d7cce260ab28a24741d043101db8d31266bad (diff) | |
download | cmdtest-0b12484dc9c100d76908a0c927b34374cbaec534.tar.gz |
Add --cd-datadir setting
-rw-r--r-- | NEWS | 4 | ||||
-rwxr-xr-x | yarn | 12 |
2 files changed, 15 insertions, 1 deletions
@@ -14,6 +14,10 @@ Version 0.19, released UNRELEASED This can be used to use Python instead of sh: `--shell=/usr/bin/python2 --shell-arg=''`. +* Yarn now supports the `--cd-datadir` setting to have each step run + in `DATADIR` instead of `SRCDIR`. The default remains `SRCDIR`, but + at some point in the future, the default will probably change. + Version 0.18, released 2015-11-06 --------------------------------- @@ -100,6 +100,11 @@ class YarnRunner(cliapp.Application): metavar='ARG', default=['-xeu']) + self.settings.boolean( + ['cd-datadir'], + 'change to DATADIR when running commands', + default=False) + def stdout(self, msg): self.output.write(msg) self.output.flush() @@ -448,6 +453,11 @@ class YarnRunner(cliapp.Application): for i, match in enumerate(m.groups('')): env['MATCH_%d' % (i+1)] = match + if self.settings['cd-datadir']: + cwd = datadir + else: + cwd = '.' + fd, shell_script = tempfile.mkstemp() os.close(fd) with open(shell_script, 'w') as f: @@ -460,7 +470,7 @@ class YarnRunner(cliapp.Application): logging.warning('shell_args: %r', shell_args) logging.warning('shell_script: %r', shell_script) exit, stdout, stderr = cliapp.runcmd_unchecked( - [shell] + shell_args + [shell_script], env=env) + [shell] + shell_args + [shell_script], env=env, cwd=cwd) os.remove(shell_script) logging.debug('Exit code: %d' % exit) |