1. Steve Losh
  2. cram


Brodie Rao  committed 665222f

Set the default shell to cmd on Windows

  • Participants
  • Parent commits d26f4fb
  • Branches default

Comments (0)

Files changed (1)

File cram.py

View file
  • Ignore whitespace
         return None
     return lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-def test(path, indent=2, shell='/bin/sh'):
+def test(path, shell, indent=2):
     """Run test at path and return input, output, and diff.
     This returns a 3-tuple containing the following:
     return p.returncode == 0
-def run(paths, tmpdir, quiet=False, verbose=False, patchcmd=None, answer=None,
-        indent=2, shell='/bin/sh'):
+def run(paths, tmpdir, shell, quiet=False, verbose=False, patchcmd=None,
+        answer=None, indent=2):
     """Run tests in paths in tmpdir.
     If quiet is True, diffs aren't printed. If verbose is True,
-                refout, postout, diff = test(abspath, indent, shell)
+                refout, postout, diff = test(abspath, shell, indent)
     args should not contain the script name.
+    if sys.platform == 'win32':
+        shell = 'cmd'
+    else:
+        shell = '/bin/sh'
     p = OptionParser(usage='cram [OPTIONS] TESTS...', prog='cram')
     p.add_option('-V', '--version', action='store_true',
                  help='show version information and exit')
                  help="don't reset common environment variables")
     p.add_option('--keep-tmpdir', action='store_true',
                  help='keep temporary directories')
-    p.add_option('--shell', action='store', default='/bin/sh', metavar='PATH',
+    p.add_option('--shell', action='store', default=shell, metavar='PATH',
                  help='shell to use for running tests')
     p.add_option('--indent', action='store', default=2, metavar='NUM',
                  type='int', help='number of spaces to use for indentation')
         answer = None
-        return run(paths, tmpdir, opts.quiet, opts.verbose, patchcmd, answer,
-                   opts.indent, shell=opts.shell)
+        return run(paths, tmpdir, shell, opts.quiet, opts.verbose, patchcmd,
+                   answer, opts.indent)
         if opts.keep_tmpdir:
             log('# Kept temporary directory: %s\n' % tmpdir)