[Python-Dev] Patch for commands.py to provide callback
Brad Doctor
brad.doctor at gmail.com
Wed Jul 5 17:21:10 CEST 2006
Greetings all,
I have attached a patch for commands.py to provide a callback ability.
Example use:
-------------------------------------
import commands
cmd = 'top -b -n2'
def fancy(out):
print 'GOT(%s)' % out.strip()
commands.cb = fancy
(s,o) = commands.getstatusoutput(cmd)
print 'OUTPUT (%s)' % o
-------------------------------------
I am not sure if this is the proper forum or means to submit something like
this, so please forgive me and advise accordingly if I am in error. The
basic idea is obvious, to allow long-running commands to call back whenever
there is output. This is against python 2.4. Please let me know if you
have any questions or suggestions.
thanks!!
-brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060705/62b26e37/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python_commandsCallBack.diff
Type: text/x-patch
Size: 891 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20060705/62b26e37/attachment-0001.bin
More information about the Python-Dev
mailing list