Fixed libedit init file problem

This commit is contained in:
Anthony Scopatz 2016-05-25 00:17:41 -04:00
parent 87de846408
commit e0ed02cdd6
3 changed files with 12 additions and 3 deletions

View file

@ -28,6 +28,8 @@ Current Developments
spaces in their path names
* Fixed a bug preventing ``source-bash`` from working on Windows
* Numerous improvements to job control via a nearly-complete rewrite
* Fixed issue with loading readline init files (inputrc) that seems to be
triggered by libedit.
* Rectified install issue with Jupyter hook when installing with pyenv,
Jupyter install hook now repects ``--prefix`` argument.
* Fixed issue with the xonsh.ply subpackage not being installed.

View file

@ -69,8 +69,12 @@ def setup_readline():
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
# load custom user settings
readline.read_init_file()
# try to load custom user settings
try:
readline.read_init_file()
except Exception:
# this seems to fail with libedit
print_exception('xonsh: could not load readline default init file.')
def teardown_readline():

View file

@ -344,7 +344,7 @@ def suggest_commands(cmd, env, aliases):
return rtn
def print_exception():
def print_exception(msg=None):
"""Print exceptions with/without traceback."""
env = getattr(builtins, '__xonsh_env__', os.environ)
if 'XONSH_SHOW_TRACEBACK' not in env:
@ -356,6 +356,9 @@ def print_exception():
exc_type, exc_value, exc_traceback = sys.exc_info()
exception_only = traceback.format_exception_only(exc_type, exc_value)
sys.stderr.write(''.join(exception_only))
if msg:
msg = msg if msg.endswith('\n') else msg + '\n'
sys.stderr.write(msg)
# Modified from Public Domain code, by Magnus Lie Hetland