Update on_chdir

This commit is contained in:
Jamie Bliss 2017-01-14 18:40:29 -05:00
parent 852af1a0dc
commit be30c54f3a
3 changed files with 4 additions and 4 deletions

View file

@ -75,9 +75,9 @@ def test_cdpath_events(xonsh_builtins, tmpdir):
ev = None ev = None
@xonsh_builtins.events.on_chdir @xonsh_builtins.events.on_chdir
def handler(old, new): def handler(olddir, newdir, **kw):
nonlocal ev nonlocal ev
ev = old, new ev = olddir, newdir
old_dir = os.getcwd() old_dir = os.getcwd()
try: try:

View file

@ -372,7 +372,7 @@ class BaseShell(object):
builtins.__xonsh_env__['PWD'] = cwd # track it now builtins.__xonsh_env__['PWD'] = cwd # track it now
if old is not None: if old is not None:
builtins.__xonsh_env__['OLDPWD'] = old # and update $OLDPWD like dirstack. builtins.__xonsh_env__['OLDPWD'] = old # and update $OLDPWD like dirstack.
events.on_chdir.fire(old, cwd) # fire event after cwd actually changed. events.on_chdir.fire(olddir=old, newdir=cwd) # fire event after cwd actually changed.
def push(self, line): def push(self, line):
"""Pushes a line onto the buffer and compiles the code in a way that """Pushes a line onto the buffer and compiles the code in a way that

View file

@ -149,7 +149,7 @@ def _change_working_directory(newdir):
# Fire event if the path actually changed # Fire event if the path actually changed
if old != env['PWD']: if old != env['PWD']:
events.on_chdir.fire(old, env['PWD']) events.on_chdir.fire(olddir=old, newdir=env['PWD'])
def _try_cdpath(apath): def _try_cdpath(apath):