summaryrefslogtreecommitdiff
path: root/yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-12-08 21:12:16 +0100
committerLars Wirzenius <liw@liw.fi>2015-12-08 21:12:55 +0100
commit70a9839743280edf915c356c309991fba6d7790d (patch)
tree3fe9d75bdac809cb067d117e70b3de20aa84a029 /yarn
parent15eb263e54ac53ffc909e98faf102c000b96e503 (diff)
downloadcmdtest-70a9839743280edf915c356c309991fba6d7790d.tar.gz
Add --shell, --shell-arg settings
Diffstat (limited to 'yarn')
-rwxr-xr-xyarn28
1 files changed, 25 insertions, 3 deletions
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: