mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
parent
1b1cf73b60
commit
dad8c527e0
|
@ -424,6 +424,11 @@ static int validate_read_args(const wchar_t *cmd, read_cmd_opts_t &opts, int arg
|
||||||
builtin_print_error_trailer(parser, streams.err, cmd);
|
builtin_print_error_trailer(parser, streams.err, cmd);
|
||||||
return STATUS_INVALID_ARGS;
|
return STATUS_INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
if (env_var_t::flags_for(argv[i]) & env_var_t::flag_read_only) {
|
||||||
|
streams.err.append_format(_(L"%ls: %ls: cannot overwrite read-only variable"), cmd, argv[i]);
|
||||||
|
builtin_print_error_trailer(parser, streams.err, cmd);
|
||||||
|
return STATUS_INVALID_ARGS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_CMD_OK;
|
return STATUS_CMD_OK;
|
||||||
|
|
|
@ -380,3 +380,12 @@ begin
|
||||||
end | read -l --line foo bar
|
end | read -l --line foo bar
|
||||||
echo $foo $bar
|
echo $foo $bar
|
||||||
# CHECK: 1 2
|
# 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user