Fix issues related to redirections and block level IO with new parser

This commit is contained in:
ridiculousfish
2013-12-28 16:18:38 -08:00
parent 715823a666
commit 0f9de11a67
7 changed files with 97 additions and 42 deletions

View File

@@ -535,6 +535,23 @@ enum token_type redirection_type_for_string(const wcstring &str, int *out_fd)
return mode;
}
int fd_redirected_by_pipe(const wcstring &str)
{
/* Hack for the common case */
if (str == L"|")
{
return STDOUT_FILENO;
}
enum token_type mode = TOK_NONE;
int fd = 0;
read_redirection_or_fd_pipe(str.c_str(), &mode, &fd);
/* Pipes only */
if (mode != TOK_PIPE || fd < 0)
fd = -1;
return fd;
}
int oflags_for_redirection_type(enum token_type type)
{
switch (type)