From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25757 invoked by alias); 5 May 2018 15:18:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23385 Received: (qmail 9314 invoked by uid 1010); 5 May 2018 15:18:26 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(-2.6/5.0):. Processed in 3.196189 secs); 05 May 2018 15:18:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=IZQxJ3 77yhTC+o3sSFq5h7SQO2R/Pm90GIIpFlhs4/4=; b=MPz5O/T91Fnn4wofNJB1AB 3FqmxNKH203nCD3Grb5VuBEMbPym1S3U7KAX3N8u9oYlUH2XrpEpe3OlGerq/Y2+ z1VBxTOvCq3z/+V203xeNrhc/Vh2hoBdmrmy/no9YxmrB2Fabock36gjlZSFEuoO aGokA8TzGBOQi2uVjHji8E1+ZXTJo0VfN7tTYbPnh9tCT/wFVpVCxPnYKFvSipUH zqDxBhaX+DTg7DwmYRuw5XnNhzMUScCKSTqXObhTJFO95TBv1FYVWnDTIrvZELSw 1HVdPPHPXD7U8++W8M0WAjEhJ2vS5mywjA2YAtC1aBERXfgoVWd1w/SHtMLwkI8w == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=IZQxJ3 77yhTC+o3sSFq5h7SQO2R/Pm90GIIpFlhs4/4=; b=jQVR2qmIZ4e6J+3TpFoICK uroevrSM337DvbbgRIvDB0HgDKvZUATj25kOa3GnGxRzdJD+LSatYYXbPV59xK0H P9iLQCajmKQEpZHEscMLQpDxX4lzW5tR4nZdYgNf6oI/6pJNxZNA+F/Lp7WUTZmR 7IMIIvp04syiKjkw/B+3+qqqPWINjxz6sknQV2nK77csf9SdaBHSuugQ7Wu6GsHx gwBWSmCTfllbNaffiSdXoHYkzHlN8tOwID3PmYhETDXFqloeYQBm9B6yxebYsJG9 4L9tUMStFmBt52Lnw+3BWdh0kZ2jG86rFrPUViRbnJaLumm2GZljU7WXGFp75QPQ == X-ME-Sender: Date: Sat, 5 May 2018 15:10:54 +0000 From: Daniel Shahaf To: Zsh Users Subject: Re: Suppress print_exit_value for single function Message-ID: <20180505151054.k4iwezfirs3uemsk@tarpaulin.shahaf.local2> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sebastian Gniazdowski wrote on Sun, Apr 29, 2018 at 20:42:43 +0200: > Hello, > in a 1-second sched function, I do: > Thanks for including the example code downthread. > __ret=$? > ... > return $__ret > > This solves $? malforming by background task. However, for `setopt > print_exit_value', this leads to constant "zsh: Exit 1" message, every > second. > I'm not sure that this is a problem. The user opted in to being notified of errors; there was an error; it was notified of. If anything, isn't the bug here that the diagnostic, "zsh: exit 1", neglects to specify the name of the function that returned that value? > Can I block `setopt print_exit_value' effects for this sched function or to > all sched functions in general? I think a feature could be added for this, > it looks very reasonable and useful. The answer ought to be "If you don't want sched functions to result in stderr spam, have your sched functions return zero.", except it sounds like doing that will override the $? variable of the main shell, creating a race condition: % echo start && make && echo end [at 12:00] start [go have some coffee] [at 12:03] a 'sched' function returns non-zero [at 12:05] 'make' finishes successfully, but "end" doesn't get printed (Right? I haven't tested this, I'm just going by your description) So, isn't the answer to that to teach the C code not to write the return value of a sched function to the global value of $? — but to keep printing printexitvalue warnings for sched functions? Cheers, Daniel