Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5db4843

Browse files
committed
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.
1 parent 7f38ec0 commit 5db4843

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

Lib/idlelib/PyShell.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,22 +325,19 @@ def build_subprocess_arglist(self):
325325

326326
def start_subprocess(self):
327327
addr = ("localhost", self.port)
328-
self.spawn_subprocess()
329328
# Idle starts listening for connection on localhost
330-
for i in range(6):
329+
for i in range(3):
331330
time.sleep(i)
332331
try:
333332
self.rpcclt = rpc.RPCClient(addr)
334333
break
335334
except socket.error, err:
336-
if i < 3:
337-
print>>sys.__stderr__, ". ",
338-
else:
339-
print>>sys.__stderr__,"\nIdle socket error: " + err[1]\
335+
print>>sys.__stderr__,"Idle socket error: " + err[1]\
340336
+ ", retrying..."
341337
else:
342338
display_port_binding_error()
343339
sys.exit()
340+
self.spawn_subprocess()
344341
# Accept the connection from the Python execution server
345342
self.rpcclt.accept()
346343
self.rpcclt.register("stdin", self.tkconsole)

0 commit comments

Comments
 (0)