diff en/examples/run-example @ 19:187702df428b

Piles of new content for MQ chapter - cookbook stuff.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 07 Jul 2006 19:56:53 -0700
parents 69d90ab9fd80
children a752b0fd3c10
line wrap: on
line diff
--- a/en/examples/run-example	Tue Jul 04 16:41:31 2006 -0700
+++ b/en/examples/run-example	Fri Jul 07 19:56:53 2006 -0700
@@ -76,6 +76,7 @@
         rcfp = open(rcfile, 'w')
         print >> rcfp, 'PS1="%s"' % self.prompt
         print >> rcfp, 'unset HISTFILE'
+        print >> rcfp, 'export EXAMPLE_DIR="%s"' % os.getcwd()
         print >> rcfp, 'export LANG=C'
         print >> rcfp, 'export LC_ALL=C'
         print >> rcfp, 'export TZ=GMT'
@@ -117,7 +118,7 @@
                         if nl: hunk += '\n'
                     ofp.write(hunk)
                     # then its output
-                    ofp.write(output)
+                    ofp.write(tex_escape(output))
             self.status('\n')
         finally:
             try:
@@ -140,7 +141,9 @@
     for name in os.listdir(path):
         if name == 'run-example' or name.startswith('.'): continue
         if name.endswith('.out') or name.endswith('~'): continue
-        example(os.path.join(path, name)).run()
+        pathname = os.path.join(path, name)
+        if os.path.isfile(pathname):
+            example(pathname).run()
     print >> open(os.path.join(path, '.run'), 'w'), time.asctime()
 
 if __name__ == '__main__':