Permalink
Browse files

Minor tweaks. Tests still pass on OSH but fail on other shells.

  • Loading branch information...
Andy Chu
Andy Chu committed Dec 9, 2017
1 parent 68d9bd5 commit 496dc462e133ab3cd5c2180e31e4a0b59060bf7f
Showing with 6 additions and 4 deletions.
  1. +6 −4 core/builtin.py
View
@@ -482,9 +482,11 @@ def Cd(argv, mem):
state.SetGlobalString(mem, 'PWD', dest_dir)
return 0
def PrintDirStack(dir_stack):
if len(dir_stack) > 0:
sys.stdout.write(' '.join(dir_stack) + '\n');
if dir_stack:
print(' '.join(dir_stack))
def Pushd(argv, dir_stack):
num_args = len(argv)
@@ -501,9 +503,9 @@ def Pushd(argv, dir_stack):
except OSError as e:
util.error("pushd: %r: %s", dest_dir, os.strerror(e.errno))
return 1
dir_stack.append(os.getcwd())
PrintDirStack(dir_stack)
return 0
@@ -516,11 +518,11 @@ def Popd(argv, dir_stack):
try:
os.chdir(dest_dir)
PrintDirStack(dir_stack)
except OSError as e:
util.error("popd: %r: %s", dest_dir, os.strerror(e.errno))
return 1
PrintDirStack(dir_stack)
return 0

0 comments on commit 496dc46

Please sign in to comment.