[Idle-dev] CVS: idle PyShell.py,1.64,1.65

Kurt B. Kaiser kbk@users.sourceforge.net
Wed, 14 May 2003 20:40:53 -0700


Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv28246

Modified Files:
	PyShell.py 
Log Message:
1. Make the startup more robust by not spawning the subprocess if IDLE
   can't acquire the port to listen on.
2. Shorten the retry and simplify the messages.


Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -r1.64 -r1.65
*** PyShell.py	15 May 2003 03:19:42 -0000	1.64
--- PyShell.py	15 May 2003 03:40:51 -0000	1.65
***************
*** 326,332 ****
      def start_subprocess(self):
          addr = ("localhost", self.port)
-         self.spawn_subprocess()
          # Idle starts listening for connection on localhost
!         for i in range(6):
              time.sleep(i)
              try:
--- 326,331 ----
      def start_subprocess(self):
          addr = ("localhost", self.port)
          # Idle starts listening for connection on localhost
!         for i in range(3):
              time.sleep(i)
              try:
***************
*** 334,345 ****
                  break
              except socket.error, err:
!                 if i < 3:
!                     print>>sys.__stderr__, ". ",
!                 else:
!                     print>>sys.__stderr__,"\nIdle socket error: " + err[1]\
                                                      + ", retrying..."
          else:
              display_port_binding_error()
              sys.exit()
          # Accept the connection from the Python execution server
          self.rpcclt.accept()
--- 333,342 ----
                  break
              except socket.error, err:
!                 print>>sys.__stderr__,"Idle socket error: " + err[1]\
                                                      + ", retrying..."
          else:
              display_port_binding_error()
              sys.exit()
+         self.spawn_subprocess()
          # Accept the connection from the Python execution server
          self.rpcclt.accept()