mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Update on_chdir
This commit is contained in:
parent
852af1a0dc
commit
be30c54f3a
3 changed files with 4 additions and 4 deletions
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Add table
Reference in a new issue