Permalink
Browse files

Merge branch 'master' into dev/oil9

  • Loading branch information...
Andy Chu
Andy Chu committed Nov 19, 2017
2 parents c65a386 + 9a81dcb commit d49b29d1c527c1da9ca49c69db5c1a3a2ce347f1
Showing with 23 additions and 3 deletions.
  1. +23 −3 core/builtin.py
View
@@ -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

Please sign in to comment.