diff options
Diffstat (limited to 'yarn')
-rwxr-xr-x | yarn | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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) |