From 70a9839743280edf915c356c309991fba6d7790d Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 8 Dec 2015 21:12:16 +0100 Subject: Add --shell, --shell-arg settings --- yarn | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'yarn') diff --git a/yarn b/yarn index 3ca0bd5..a18aa8e 100755 --- a/yarn +++ b/yarn @@ -88,6 +88,18 @@ class YarnRunner(cliapp.Application): ['require-assumptions'], 'require ASSUMING to always pass') + self.settings.string( + ['shell'], + 'run IMPLEMENTS using SHELL', + metavar='SHELL', + default='/bin/sh') + + self.settings.string_list( + ['shell-arg'], + 'use ARG when running shell', + metavar='ARG', + default=['-xeu']) + def stdout(self, msg): self.output.write(msg) self.output.flush() @@ -436,10 +448,20 @@ class YarnRunner(cliapp.Application): for i, match in enumerate(m.groups('')): env['MATCH_%d' % (i+1)] = match - shell_script = '%s\n\n%s\n' % ( - shell_prelude, step.implementation.shell) + fd, shell_script = tempfile.mkstemp() + os.close(fd) + with open(shell_script, 'w') as f: + f.write(shell_prelude) + f.write(step.implementation.shell) + f.flush() + shell = self.settings['shell'] + shell_args = self.settings['shell-arg'] + logging.warning('shell: %r', shell) + logging.warning('shell_args: %r', shell_args) + logging.warning('shell_script: %r', shell_script) exit, stdout, stderr = cliapp.runcmd_unchecked( - ['sh', '-xeuc', shell_script], env=env) + [shell] + shell_args + [shell_script], env=env) + os.remove(shell_script) logging.debug('Exit code: %d' % exit) if stdout: -- cgit v1.2.1