mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
Update aliases.py
Move update to OLDPWD down so we don't overwrite it accidentally.
This commit is contained in:
parent
b4179c1dc6
commit
ca60a170a2
1 changed files with 1 additions and 1 deletions
|
@ -12,7 +12,6 @@ def cd(args, stdin=None):
|
||||||
changes to the current user's home directory.
|
changes to the current user's home directory.
|
||||||
"""
|
"""
|
||||||
cur_oldpwd = builtins.__xonsh_env__['OLDPWD']
|
cur_oldpwd = builtins.__xonsh_env__['OLDPWD']
|
||||||
builtins.__xonsh_env__['OLDPWD'] = os.getcwd()
|
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
d = os.path.expanduser('~')
|
d = os.path.expanduser('~')
|
||||||
elif len(args) == 1:
|
elif len(args) == 1:
|
||||||
|
@ -25,6 +24,7 @@ def cd(args, stdin=None):
|
||||||
return '', 'cd: no such file or directory: {0}\n'.format(d)
|
return '', 'cd: no such file or directory: {0}\n'.format(d)
|
||||||
if not os.path.isdir(d):
|
if not os.path.isdir(d):
|
||||||
return '', 'cd: {0} is not a directory\n'.format(d)
|
return '', 'cd: {0} is not a directory\n'.format(d)
|
||||||
|
builtins.__xonsh_env__['OLDPWD'] = os.getcwd()
|
||||||
os.chdir(d)
|
os.chdir(d)
|
||||||
builtins.__xonsh_env__['PWD'] = os.getcwd()
|
builtins.__xonsh_env__['PWD'] = os.getcwd()
|
||||||
return None, None
|
return None, None
|
||||||
|
|
Loading…
Add table
Reference in a new issue