From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11247 invoked by alias); 23 Oct 2015 19:06:38 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36925 Received: (qmail 18457 invoked from network); 23 Oct 2015 19:06:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=mxeGjbJ7rfFPYFPwZ+Atetzt2VEszOHltkIqhVybIkY=; b=ehW0z97mRDExQJDXy+n/t07tk3pHU810u/PO4cACbhQ8/gV1oCnsqgVASiOzoszS9C pw5Ho+eVarHWPMD1wYnlu4mmwy7NOhuO0RT/Zq9Z2IzNB3dpshIvWOJMg02R1yoE0X+1 33Em0VMPU/Cxx9HsbG0Mnxzo5OI9GqkKNvNXavTdYvT6BjM1b7qYz69UVe72jlSmnOQ+ 7FQZN2Rkl6RD6jsMQ0YD5tMKRon65TrSYq+94CEvnrnjDkA6RD6fVFQ0OwuxFb4e8gaq Em0qGevGISydXBEQteHPBwI410XyiTFmT5OCXmPoIj8u4aW+XK2PKIMy7wncp+AcFt8f rqIQ== X-Gm-Message-State: ALoCoQm1MmLfekzs1jeAEshBeCLfaeKmOTO7E07Ll5Sd0aCbHt6C6sj19ajDsnQRrH6TpZQzE1KA X-Received: by 10.60.17.66 with SMTP id m2mr16809025oed.36.1445627194783; Fri, 23 Oct 2015 12:06:34 -0700 (PDT) From: Bart Schaefer Message-Id: <151023120632.ZM7970@torch.brasslantern.com> Date: Fri, 23 Oct 2015 12:06:32 -0700 In-Reply-To: Comments: In reply to Ismail Donmez "Can't redirect segmentation fault error to file" (Oct 23, 7:06am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Can't redirect segmentation fault error to file MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 23, 7:06am, Ismail Donmez wrote: } } Suppose I have a crashing executable: } } For some reason I want to redirect the segmentation fault error to a file. The segmentation fault error isn't printed by the failing command, it's printed by the shell when it is notified of the failed exit status of the command. Zsh sends job control messages to the "shell output" (typically the terminal) rather than to standard error, so redirecting standard error won't trap anything. That said, I'm not entirely sure why it doesn't print anything at all: torch% bash -c 'kill -SEGV $$' zsh: segmentation fault (core dumped) bash -c 'kill -SEGV $$' torch% { bash -c 'kill -SEGV $$' } torch% Braces suppress job exit status messages as far back as zsh 4.2.0 (maybe farther). One other thing -- I'm not sure why you're getting [1] 6511 segmentation fault (core dumped) ./a.out when in your example the job does not appear to have been backgrounded. The job number "[1]" should only appear like that for background jobs: torch% bash -c 'kill -SEGV $$' & [1] 7957 torch% [1] + 7957 segmentation fault (core dumped) bash -c 'kill -SEGV $$' and in THAT case I get: torch% { bash -c 'kill -SEGV $$' & } 2>err [2] 7963 torch% [2] + segmentation fault (core dumped) bash -c 'kill -SEGV $$' torch% cat err torch% In 4.2 the job start message is printed to stderr, but the job termination message is not: zsh-4.2.0% { bash -c 'kill -SEGV $$' & } 2>err zsh-4.2.0% [2] + 7959 segmentation fault (core dumped) bash -c 'kill -SEGV $$' zsh-4.2.0% cat err [2] 7959 zsh-4.2.0% So where the messages go is at least now consistent in 5.1.