[Python-checkins] python/dist/src/Lib subprocess.py,NONE,1.1

effbot at users.sourceforge.net effbot at users.sourceforge.net
Tue Oct 12 17:26:29 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24287/Lib

Added Files:
	subprocess.py 
Log Message:
Added Peter Astrand's subprocess module.



--- NEW FILE: subprocess.py ---
# subprocess - Subprocesses with accessible I/O streams
#
# For more information about this module, see PEP 324. 
#
# Copyright (c) 2003-2004 by Peter Astrand <astrand at lysator.liu.se>
#
# By obtaining, using, and/or copying this software and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the following terms and conditions:
#
# Permission to use, copy, modify, and distribute this software and
# its associated documentation for any purpose and without fee is
# hereby granted, provided that the above copyright notice appears in
# all copies, and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of the
# author not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
[...1102 lines suppressed...]
    print "Looking for 'PROMPT' in set output..."
    p1 = Popen("set", stdout=PIPE, shell=True)
    p2 = Popen('find "PROMPT"', stdin=p1.stdout, stdout=PIPE)
    print repr(p2.communicate()[0])

    #
    # Example 2: Simple execution of program
    #
    print "Executing calc..."
    p = Popen("calc")
    p.wait()


if __name__ == "__main__":
    if mswindows:
        _demo_windows()
    else:
        _demo_posix()

    



More information about the Python-checkins mailing list