Permalink
Browse files
Merge branch 'master' into dev/oil9
- Loading branch information...
Showing
with
23 additions
and
3 deletions.
-
+23
−3
core/builtin.py
|
|
@@ -484,9 +484,23 @@ def Cd(argv, mem): |
|
|
|
|
|
|
|
|
def Pushd(argv, dir_stack):
|
|
|
dir_stack.append(os.getcwd())
|
|
|
num_args = len(argv)
|
|
|
|
|
|
if num_args <= 0:
|
|
|
util.error('pushd: no other directory')
|
|
|
return 1
|
|
|
elif num_args > 1:
|
|
|
util.error('pushd: too many arguments')
|
|
|
return 1
|
|
|
|
|
|
dest_dir = argv[0]
|
|
|
os.chdir(dest_dir) # TODO: error checking
|
|
|
try:
|
|
|
os.chdir(dest_dir)
|
|
|
except OSError as e:
|
|
|
util.error("cd: %r: %s", dest_dir, os.strerror(e.errno))
|
|
|
return 1
|
|
|
|
|
|
dir_stack.append(os.getcwd())
|
|
|
return 0
|
|
|
|
|
|
|
|
|
@@ -496,7 +510,13 @@ def Popd(argv, dir_stack): |
|
|
except IndexError:
|
|
|
log('popd: directory stack is empty')
|
|
|
return 1
|
|
|
os.chdir(dest_dir) # TODO: error checking
|
|
|
|
|
|
try:
|
|
|
os.chdir(dest_dir)
|
|
|
except OSError as e:
|
|
|
util.error("cd: %r: %s", dest_dir, os.strerror(e.errno))
|
|
|
return 1
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
0 comments on commit
d49b29d