zsh-users
 help / color / mirror / code / Atom feed
* Weird behavior with the time command and background jobs
@ 2020-08-12 15:18 Rudi C
  2020-08-13 18:15 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Rudi C @ 2020-08-12 15:18 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

```
~
❯ f2() { eval "$@" & }

~
❯ time (f2 sleep 3 )
( f2 sleep 3; )  0.00s user 0.01s system 0% cpu 3.014 total

~
❯ f3() { (eval "$@" &) }

~
❯ time (f3 sleep 3)
( f3 sleep 3; )  0.00s user 0.00s system 41% cpu 0.007 total
```

Why is `f2` getting 3 seconds? It's running the job in the background, just
like `f3`. In fact, their interactive behavior (without the time command)
is the same.

[-- Attachment #2: Type: text/html, Size: 559 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-13 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 15:18 Weird behavior with the time command and background jobs Rudi C
2020-08-13 18:15 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).