mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-01 15:14:26 +08:00
3616dd5889
Instead of globally marking the state as "in block" when evaluating blocks/functions, update the "in block" status when pushing/popping blocks on the parser stack. Fixes #1729. On a side note, `status -b` is actually pretty useless, because it always returns 0 inside of a function (even without this patch).
18 lines
305 B
Fish
18 lines
305 B
Fish
# vim: set filetype=fish:
|
|
|
|
status -b
|
|
or echo 'top level'
|
|
|
|
begin
|
|
status -b
|
|
end
|
|
and echo 'block'
|
|
|
|
# Issue #1728
|
|
# Bad file redirection on a block causes `status --is-block` to return 0 forever.
|
|
begin; end >/ # / is a directory, it can't be opened for writing
|
|
status -b
|
|
and echo 'unexpected block'
|
|
|
|
true
|