only remove attribute if it exists

Attempt to fix #2264 which only rears its head during history replay (on
linux).
This commit is contained in:
Gil Forsyth 2017-02-27 10:55:14 -05:00
parent b5f48cdcee
commit f71e191cd8
2 changed files with 16 additions and 1 deletions

View file

@ -0,0 +1,14 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* ``history replay`` no longer barfs on ``style_name`` when setting up the
environment
**Security:** None

View file

@ -1576,6 +1576,7 @@ def intensify_colors_on_win_setter(enable):
"""
enable = to_bool(enable)
if hasattr(builtins, '__xonsh_shell__'):
if hasattr(builtins.__xonsh_shell__.shell.styler, 'style_name'):
delattr(builtins.__xonsh_shell__.shell.styler, 'style_name')
return enable