Make "time" a job prefix

In particular, this allows `true && time true`, or `true; and time true`,
and both `time not true` as well as `not time true` (like bash).

time is valid only as job _prefix_, so `true | time true` could call
`/bin/time` (same in bash)

See discussion in #6442
This commit is contained in:
Johannes Altmanninger
2019-12-21 11:45:07 +01:00
committed by Mahmoud Al-Qudsi
parent c1140bc436
commit 3de95038b0
13 changed files with 101 additions and 42 deletions

View File

@@ -25,3 +25,21 @@ time echo 'foo -s bar'
#CHECKERR: Executed in {{[\d,.\s]*}} {{millis|micros|secs}} {{\s*}}fish {{\s*}}external
#CHECKERR: usr time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
#CHECKERR: sys time {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}} {{[\d,.\s]*}} {{millis|micros|secs}}
true && time a=b not builtin true | true
#CHECKERR: ___{{.*}}
#CHECKERR: {{.*}}
#CHECKERR: {{.*}}
#CHECKERR: {{.*}}
PATH= time true
#CHECKERR: fish: Unknown command: time
#CHECKERR: {{.*}}
#CHECKERR: PATH= time true
#CHECKERR: ^
not time true
#CHECKERR: ___{{.*}}
#CHECKERR: {{.*}}
#CHECKERR: {{.*}}
#CHECKERR: {{.*}}