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