read: Error on read-only variables

Fixes #9346
This commit is contained in:
Fabian Boehm
2023-01-13 17:56:28 +01:00
parent 1b1cf73b60
commit dad8c527e0
2 changed files with 14 additions and 0 deletions

View File

@@ -380,3 +380,12 @@ begin
end | read -l --line foo bar
echo $foo $bar
# CHECK: 1 2
echo foo | read status
# CHECKERR: read: status: cannot overwrite read-only variable
# CHECKERR: {{.*}}read.fish (line {{\d+}}):
# CHECKERR: echo foo | read status
# CHECKERR: ^
# CHECKERR: (Type 'help read' for related documentation)
echo read $status
# CHECK: read 2