Author: dmeyer
Date: Sat Mar 25 17:23:14 2006
New Revision: 1331
Modified:
trunk/base/src/ipc.py
Log:
remove launch code
Modified: trunk/base/src/ipc.py
==============================================================================
--- trunk/base/src/ipc.py (original)
+++ trunk/base/src/ipc.py Sat Mar 25 17:23:14 2006
@@ -1102,59 +1102,3 @@
# If remote has disconnected, find out now.
client.handle_read()
return client.socket != None
-
-
-def launch(server, timeout, client, *args, **kwargs):
- """
- Try to execute client(*args, **kwargs) to connect the client to
- the ipc server. If this does not work, launch the server and try
- again. 'server' is either a string (file) or a list (file +
- arguments). You do not need to add the Python interpreter
- here. After launching, client(*args, **kwargs) will be tried for
- the next 'timeout' seconds using notifier.step(). If connecting
- does not work, raise a RunTimeError, if it does work, return the
- result of client(*args, **kwargs). The server won't stop when the
- client stops, it has to stop on it's own.
- """
- try:
- # try to connect to an already running server
- return client(*args, **kwargs)
- except socket.error:
- pass
-
- if isinstance(server, str):
- server = [ server ]
- log.info('start python -OO %s', ' '.join(server))
- server_fd = popen2.popen3(['python', '-OO'] + server)
-
- # wait for server to start
- # use a small timer to make sure step() comes back
- stop = time.time() + timeout
- t = kaa.notifier.Timer(lambda x: True, 1)
- t.start(0.01)
- while time.time() < stop:
- kaa.notifier.step()
- try:
- c = client(*args, **kwargs)
- # client ready, close fd to server
- for fd in server_fd:
- fd.close()
- # stop temp timer
- t.stop()
- return c
- except socket.error:
- pass
-
- # no server found, print debug
- for fd in server_fd:
- try:
- for msg in fd.readlines():
- log.error(msg[:-1])
- except IOError:
- pass
- fd.close()
- # stop temp timer
- t.stop()
-
- # raise error
- raise RuntimeError('Unable to start python -OO %s' % ' '.join(server))
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog