PyXR

c:\python24\lib \ test \ tf_inherit_check.py



0001 # Helper script for test_tempfile.py.  argv[2] is the number of a file
0002 # descriptor which should _not_ be open.  Check this by attempting to
0003 # write to it -- if we succeed, something is wrong.
0004 
0005 import sys
0006 import os
0007 
0008 verbose = (sys.argv[1] == 'v')
0009 try:
0010     fd = int(sys.argv[2])
0011 
0012     try:
0013         os.write(fd, "blat")
0014     except os.error:
0015         # Success -- could not write to fd.
0016         sys.exit(0)
0017     else:
0018         if verbose:
0019             sys.stderr.write("fd %d is open in child" % fd)
0020         sys.exit(1)
0021 
0022 except StandardError:
0023     if verbose:
0024         raise
0025     sys.exit(1)
0026 

Generated by PyXR 0.9.4
SourceForge.net Logo