Mercurial > hgbook
comparison en/examples/run-example @ 70:365b41b6a15e
bash is not necessarily in /bin.
Original patch against an earlier rev from Guy Brand <gb@isis.u-strasbg.fr>.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue, 08 Aug 2006 14:13:28 -0700 |
parents | c574ce277a2b |
children | ddf533d41c09 |
comparison
equal
deleted
inserted
replaced
69:e9dd634ab99e | 70:365b41b6a15e |
---|---|
23 if '}' in s: | 23 if '}' in s: |
24 s = s.replace('}', '\\}') | 24 s = s.replace('}', '\\}') |
25 return s | 25 return s |
26 | 26 |
27 class example: | 27 class example: |
28 shell = '/bin/bash' | 28 shell = '/usr/bin/env bash' |
29 prompt = '__run_example_prompt__\n' | 29 prompt = '__run_example_prompt__\n' |
30 pi_re = re.compile('#\$\s*(name):\s*(.*)$') | 30 pi_re = re.compile('#\$\s*(name):\s*(.*)$') |
31 | 31 |
32 def __init__(self, name): | 32 def __init__(self, name): |
33 self.name = name | 33 self.name = name |
87 rcfp.close() | 87 rcfp.close() |
88 sys.stdout.flush() | 88 sys.stdout.flush() |
89 sys.stderr.flush() | 89 sys.stderr.flush() |
90 pid, fd = pty.fork() | 90 pid, fd = pty.fork() |
91 if pid == 0: | 91 if pid == 0: |
92 cmdline = ['/bin/bash', '--noediting', '--noprofile', '--norc'] | 92 cmdline = ['/usr/bin/env', 'bash', '--noediting', '--noprofile', |
93 '--norc'] | |
93 try: | 94 try: |
94 os.execv(cmdline[0], cmdline) | 95 os.execv(cmdline[0], cmdline) |
95 except OSError, err: | 96 except OSError, err: |
96 print >> sys.stderr, '%s: %s' % (cmdline[0], err.strerror) | 97 print >> sys.stderr, '%s: %s' % (cmdline[0], err.strerror) |
97 sys.stderr.flush() | 98 sys.stderr.flush() |