|
|
@@ -322,7 +322,7 @@ def Jobs(argv, job_state): |
|
|
# - If there are more words than names, the remaining words and their
|
|
|
# intervening delimiters are assigned to the last name.
|
|
|
# - If there are fewer words read from the input stream than names, the
|
|
|
# remaining names are assigned empty values.
|
|
|
# remaining names are assigned empty values.
|
|
|
# - The characters in the value of the IFS variable are used to split the line
|
|
|
# into words using the same rules the shell uses for expansion (described
|
|
|
# above in Word Splitting).
|
|
|
@@ -484,11 +484,16 @@ def Shift(argv, mem): |
|
|
|
|
|
return mem.Shift(n)
|
|
|
|
|
|
CD_SPEC = _Register('cd')
|
|
|
CD_SPEC.ShortFlag('-L')
|
|
|
CD_SPEC.ShortFlag('-P')
|
|
|
|
|
|
def Cd(argv, mem, dir_stack):
|
|
|
# TODO: Parse flags, error checking, etc.
|
|
|
arg, i = CD_SPEC.Parse(argv)
|
|
|
# TODO: error checking, etc.
|
|
|
|
|
|
try:
|
|
|
dest_dir = argv[0]
|
|
|
dest_dir = argv[i]
|
|
|
except IndexError:
|
|
|
val = mem.GetVar('HOME')
|
|
|
if val.tag == value_e.Undef:
|
|
|
@@ -526,7 +531,13 @@ def Cd(argv, mem, dir_stack): |
|
|
util.error("cd %r: %s", dest_dir, os.strerror(e.errno))
|
|
|
return 1
|
|
|
|
|
|
state.SetGlobalString(mem, 'PWD', dest_dir) # Set $PWD.
|
|
|
# Set $PWD.
|
|
|
# `-L` is the default behavior; no need to check it
|
|
|
# TODO: ensure that if multiple flags are provided, the *last* one overrides
|
|
|
# the others
|
|
|
pwd = os.path.realpath(dest_dir) if arg.P else dest_dir
|
|
|
state.SetGlobalString(mem, 'PWD', pwd)
|
|
|
|
|
|
dir_stack.Reset() # for pushd/popd/dirs
|
|
|
|
|
|
return 0
|
|
|
@@ -830,7 +841,7 @@ def _ResolveNames(names, funcs, path_val): |
|
|
results.append(kind)
|
|
|
|
|
|
return results
|
|
|
|
|
|
|
|
|
|
|
|
COMMAND_SPEC = _Register('command')
|
|
|
COMMAND_SPEC.ShortFlag('-v')
|
|
|
@@ -1088,7 +1099,7 @@ def Umask(argv): |
|
|
# NOTE: dash disables interrupts around the two umask() calls, but that
|
|
|
# shouldn't be a concern for us. Signal handlers won't call umask().
|
|
|
mask = os.umask(0)
|
|
|
os.umask(mask) #
|
|
|
os.umask(mask) #
|
|
|
print('0%03o' % mask) # octal format
|
|
|
return 0
|
|
|
|
|
|
|
0 comments on commit
179be3f