hgbook

diff en/examples/run-example @ 167:e67251ac336f

Small portability change. "grep -P" doesn't work on Debian.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue Mar 27 01:15:34 2007 -0500 (2007-03-27)
parents 8f4c9ae918af
children f8b5b782e150
line diff
     1.1 --- a/en/examples/run-example	Mon Mar 26 22:28:25 2007 -0700
     1.2 +++ b/en/examples/run-example	Tue Mar 27 01:15:34 2007 -0500
     1.3 @@ -50,7 +50,7 @@
     1.4      shell = '/usr/bin/env bash'
     1.5      ps1 = '__run_example_ps1__ '
     1.6      ps2 = '__run_example_ps2__ '
     1.7 -    pi_re = re.compile(r'#\$\s*(name|ignore):\s*(.*)$')
     1.8 +    pi_re = re.compile(r'#\$\s*(drop_output|name|ignore):\s*(.*)$')
     1.9      
    1.10      timeout = 5
    1.11  
    1.12 @@ -189,6 +189,8 @@
    1.13  
    1.14          err = False
    1.15  
    1.16 +        drop_output = False
    1.17 +
    1.18          try:
    1.19              try:
    1.20                  # eat first prompt string from shell
    1.21 @@ -219,10 +221,12 @@
    1.22                                  ofp = None
    1.23                          elif pi == 'ignore':
    1.24                              ignore.append(rest)
    1.25 +                        elif pi == 'drop_output':
    1.26 +                            drop_output = dict(yes=1,no=0)[rest.lower()]
    1.27                      elif hunk.strip():
    1.28                          # it's something we should execute
    1.29                          newps, output = self.sendreceive(hunk)
    1.30 -                        if not ofp:
    1.31 +                        if not ofp or drop_output:
    1.32                              continue
    1.33                          # first, print the command we ran
    1.34                          if not hunk.startswith('#'):