Skip to content

Commit

Permalink
1. Make the startup more robust by not spawning the subprocess if IDLE
Browse files Browse the repository at this point in the history
   can't acquire the port to listen on.
2. Shorten the retry and simplify the messages.
  • Loading branch information
kbkaiser committed May 15, 2003
1 parent 7f38ec0 commit 5db4843
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Lib/idlelib/PyShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,22 +325,19 @@ def build_subprocess_arglist(self):

def start_subprocess(self):
addr = ("localhost", self.port)
self.spawn_subprocess()
# Idle starts listening for connection on localhost
for i in range(6):
for i in range(3):
time.sleep(i)
try:
self.rpcclt = rpc.RPCClient(addr)
break
except socket.error, err:
if i < 3:
print>>sys.__stderr__, ". ",
else:
print>>sys.__stderr__,"\nIdle socket error: " + err[1]\
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()
self.rpcclt.register("stdin", self.tkconsole)
Expand Down

0 comments on commit 5db4843

Please sign in to comment.