Skip to content

When time command is given data on stdin, it either prints the man page for time or doesn't notice non-zero subprocess exit or show stderr #8841

@terrycojones

Description

@terrycojones

fish version 3.4.1 on OS X 12.2.1

If I run yes | time cat lkslkjlklkslsj (where the file passed to cat is non-existent), I get a prompt back immediately, nothing appears on standard error, and the exit status ($status) is 2. The same thing happens if I run e.g., cat /etc/passwd | time cat lkslkjlk. When I do the same thing without time I get the expected message about a non-existent file on standard error from the cat and the exit status is 1. So it appears time has detected the non-zero exit status but suppressed the standard error output and it exits with 2.

Bizarrely, if I run echo hi | time cat lskjlsjsjlskjlskj, fish displays what I see when I run man time (including piping it to what seems to be more (not less which is what I have $PAGER set to))! Maybe because these are both builtin commands fish does something unexpected (at least to me).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions