Readd ^&1 redirection

This was lost in 35671dd9f0.

Even tho we plan to drop caret redirection, while it's there it should
fully work.

Fixes #6591.

(cherry picked from commit 13b470af07)
This commit is contained in:
Fabian Homborg 2020-02-14 20:27:30 +01:00 committed by David Adam
parent cecb0ebbbc
commit eea919f97e
2 changed files with 8 additions and 1 deletions

View file

@ -412,7 +412,12 @@ maybe_t<pipe_or_redir_t> pipe_or_redir_t::from_string(const wchar_t *buff) {
consume(L'^');
result.fd = STDERR_FILENO;
result.mode = redirection_mode_t::overwrite;
if (try_consume(L'^')) result.mode = redirection_mode_t::append;
if (try_consume(L'^')) {
result.mode = redirection_mode_t::append;
} else if (try_consume(L'&')) {
// This is a redirection to an fd.
result.mode = redirection_mode_t::fd;
}
if (try_consume(L'?')) result.mode = redirection_mode_t::noclob;
break;
}

View file

@ -0,0 +1,2 @@
#RUN: %fish --features no-stderr-nocaret -c 'ls /abavojijsdfhdsjhfuihifoisj ^&1'
# CHECK: ls: {{.*}}