Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6459
Modified Files:
popen3.py
Log Message:
add run function as better os.system
Index: popen3.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/popen3.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** popen3.py 4 Jan 2004 13:07:32 -0000 1.9
--- popen3.py 28 May 2004 20:22:32 -0000 1.10
***************
*** 11,14 ****
--- 11,17 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.10 2004/05/28 20:22:32 dischi
+ # add run function as better os.system
+ #
# Revision 1.9 2004/01/04 13:07:32 dischi
# close file handlers
***************
*** 189,190 ****
--- 192,221 ----
child.tochild.close()
return ret
+
+
+ def run(app, object, signal=15):
+ """
+ run a child until object.abort is True. Than kill the child with
+ the given signal
+ """
+ if isinstance(app, str) or isinstance(app, unicode):
+ print 'WARNING: popen.run with string as app'
+ print 'This may cause some problems with threads'
+
+ child = popen2.Popen3(app, 1, 100)
+ child.childerr.close()
+ child.fromchild.close()
+ while(1):
+ time.sleep(0.1)
+ if object.abort:
+ os.kill(child.pid, signal)
+
+ try:
+ pid = os.waitpid(child.pid, os.WNOHANG)[0]
+ except OSError:
+ break
+
+ if pid:
+ break
+
+ child.tochild.close()
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog