From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8190 invoked from network); 12 Aug 2020 15:34:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Aug 2020 15:34:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=QFNUlZX/P23S/i9X+eDLi78Gm1qqs5aLNsTVIwgY6jY=; b=C7Zn8l+7hqIT67oCVGIhJ34Prr bbq8aM/guf5hHXkm4NKbJQP+BJyIn7TlxCWR78PnPLt6KOYAaelurVrGrsqeyKkZjo4JROwu3q9e9 QviZDXurCBobEid/cR4Omz4/H4n3h0URt4SDIYCX3lH74rdEAiC4s4dTYMlE7tCEst8l/JVqfFTBm dkiLDmO/VZyMdufIQOxlodBlTiRlHxNTFpE1dgcerwHSoxzZBM9OzmClLlofJXUnY3AX6s+CCpfpo FSFS3j7YmfaNI0TUEHKQrnAVdkKcHFoorgrO3ecZq3LDfO9BfBNllKaSsJp+9CldF8OR/rudppTK6 JyQvUYtw==; Received: from authenticated user by zero.zsh.org with local id 1k5smG-000IEI-He; Wed, 12 Aug 2020 15:34:56 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f177.google.com) smtp.remote-ip=209.85.167.177; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256 Received: from mail-oi1-f177.google.com ([209.85.167.177]:45855) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1k5sWo-000HVZ-M5; Wed, 12 Aug 2020 15:18:59 +0000 Received: by mail-oi1-f177.google.com with SMTP id o21so2099358oie.12 for ; Wed, 12 Aug 2020 08:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=QFNUlZX/P23S/i9X+eDLi78Gm1qqs5aLNsTVIwgY6jY=; b=jOWdLxQfaIe0MkYQed+bB0NZhDpUYjdbvzXfZom/xBdWqphBCIBFVma+4VMNqLewGw 5MPDyo6670k774FKPNaxy9nAYNHkqG/QLFb4y5Lp2k8zSyEG/Ael+eCNIAmkTnN/MjKi Thg7SccQ/7kMHg5wMn2pCatreS/NzbpqEyd7BWZu/ZyjqknIYYonWDqnZugz4nScXXce DjKA8+r7j6uqJYycJdnH3PcVQ+GKcTrqMGXPVX7v8NABFb2jZBObrYE+gKxDpfwv2sjD LWzsm3dTEODRbvYl4lfHSeMnC8brB/h5oGOd7+cnPq0+030S0lokEZn2lmPh+911eyg2 Ay0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=QFNUlZX/P23S/i9X+eDLi78Gm1qqs5aLNsTVIwgY6jY=; b=qL+SFCzliYZDYSUJsOD6RajaXJj0AtkrNa+TbutxJxU0Q2Fi5kqZS91oKHd3q7P9Wa a0di0h77wHIAlzjy8+Mek9gZz4uq97Y6BO3bxRy8B7svErSgVj5lu09gXHgdOssUGM5z Xos+BKTVMeZwQ/jug1XyvZ9YCXoq8yivb7NUqPljV1vn+qmMiGaLLioIsf2urtjCkD8u /KhafA/aoPRTxyPR7ZzQfz1sGKZbePLpTvMJf0hn0WHBMkncs31w2bqFUuNw1JGj65zz xMn14udv5aBUQty3xWax8Cop78MpFstBVElq1wSy2M1OgHodQIcJXSYclG+pavk2aBwA SWhQ== X-Gm-Message-State: AOAM532Njt158no39wAz+Id9gy/3ROxjnnJCagO1I3/av8p/keCjQggC 5cmVyVVzU5LQdBUNHECqIMTz48Yp9LSCDuGoAUUSiRVznXI= X-Google-Smtp-Source: ABdhPJzmz2d48kyVIHhq1ioU2OF/36FY9/7BRMlHWM4j7jVjH/RXnpqElllVT1JLEYQ+jis4w9MaPqLWC6LzsQn4eZM= X-Received: by 2002:aca:ea54:: with SMTP id i81mr7888731oih.133.1597245533972; Wed, 12 Aug 2020 08:18:53 -0700 (PDT) MIME-Version: 1.0 From: Rudi C Date: Wed, 12 Aug 2020 19:48:27 +0430 Message-ID: Subject: Weird behavior with the time command and background jobs To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000abeab605acafb4a6" X-Zsh-Org-Should-ARC-Sign: true X-Validation-by: opk@zsh.org X-Seq: 26017 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: --000000000000abeab605acafb4a6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ``` ~ =E2=9D=AF f2() { eval "$@" & } ~ =E2=9D=AF time (f2 sleep 3 ) ( f2 sleep 3; ) 0.00s user 0.01s system 0% cpu 3.014 total ~ =E2=9D=AF f3() { (eval "$@" &) } ~ =E2=9D=AF 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. --000000000000abeab605acafb4a6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
```
~
=E2=9D=AF f2() { eval "$@" &a= mp; }

~
=E2=9D=AF time (f2 sleep 3 )
( f2 sleep 3; ) =C2=A00.0= 0s user 0.01s system 0% cpu 3.014 total

~
=E2=9D=AF f= 3() { (eval "$@" &) }

~
=E2=9D=AF time (f3 sleep 3)=
( f3 sleep 3; ) =C2=A00.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 intera= ctive behavior (without the time command) is the same.
--000000000000abeab605acafb4a6--