Make fish_indent stop panicing on closed stdin

Prior to this commit, this code:

    fish_indent <&-

would panic as we would construct a File with a negative fd.
Check for a closed fd as other builtins do.
This commit is contained in:
Peter Ammon
2025-12-30 12:33:33 -08:00
parent eb803ba6a7
commit 4101e831af
2 changed files with 11 additions and 0 deletions

View File

@@ -652,3 +652,7 @@ cat $tmpdir/indent_test.fish
# See that the builtin can be redirected
printf %s\n a b c | builtin fish_indent | grep b
# CHECK: b
# Regression test that fish_indent doesn't panic with closed stdin.
fish_indent <&-
# CHECKERR: fish_indent: stdin is closed