This commit is contained in:
Anthony Scopatz 2016-06-16 21:21:57 -04:00
parent 5fd1d4f4a8
commit 1fc3a2efa2
2 changed files with 7 additions and 3 deletions

View file

@ -70,7 +70,8 @@ def to_debug(x):
execer's debug level.
"""
val = to_bool_or_int(x)
builtins.__xonsh_execer__.debug_level = val
if hasattr(builtins, '__xonsh_execer__'):
builtins.__xonsh_execer__.debug_level = val
return val
Ensurer = namedtuple('Ensurer', ['validate', 'convert', 'detype'])

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""The xonsh shell"""
import os
import random
import builtins
from warnings import warn
@ -9,7 +10,7 @@ from xonsh.environ import xonshrc_context
from xonsh.execer import Execer
from xonsh.platform import (best_shell_type, has_prompt_toolkit, ptk_version,
ptk_version_info)
from xonsh.tools import XonshError
from xonsh.tools import XonshError, to_bool_or_int
class Shell(object):
@ -81,7 +82,9 @@ class Shell(object):
def _init_environ(self, ctx, config, rc, scriptcache, cacheall):
self.ctx = {} if ctx is None else ctx
self.execer = Execer(config=config, login=self.login, xonsh_ctx=self.ctx)
debug = to_bool_or_int(os.getenv('XONSH_DEBUG', '0'))
self.execer = Execer(config=config, login=self.login, xonsh_ctx=self.ctx,
debug_level=debug)
self.execer.scriptcache = scriptcache
self.execer.cacheall = cacheall
if self.stype != 'none' or self.login: