diff --git a/IPython/rlineimpl.py b/IPython/rlineimpl.py index aa0ba63..b5afb3c 100644 --- a/IPython/rlineimpl.py +++ b/IPython/rlineimpl.py @@ -33,7 +33,19 @@ if sys.platform == 'win32' and have_readline: uses_libedit = False if sys.platform == 'darwin' and have_readline: import commands - (status, result) = commands.getstatusoutput( "otool -L %s | grep libedit" % _rl.__file__ ) + # Boyd's patch had a 'while True' here, I'm always a little worried about + # infinite loops with such code, so for now I'm taking a more conservative + # approach. See https://bugs.launchpad.net/ipython/+bug/411599. + for i in range(10): + try: + (status, result) = commands.getstatusoutput( "otool -L %s | grep libedit" % _rl.__file__ ) + break + except IOError, (errno, strerror): + if errno == 4: + continue + else + break + if status == 0 and len(result) > 0: # we are bound to libedit - new in Leopard _rl.parse_and_bind("bind ^I rl_complete")