From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: stderr patch Date: Sat, 22 Mar 2014 10:43:18 +0100 Message-ID: References: <532D0AB1.6080708@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRISX-0002PR-4A for emacs-orgmode@gnu.org; Sat, 22 Mar 2014 05:43:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WRISV-0002Sq-O3 for emacs-orgmode@gnu.org; Sat, 22 Mar 2014 05:43:21 -0400 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:54749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRISV-0002Sj-KI for emacs-orgmode@gnu.org; Sat, 22 Mar 2014 05:43:19 -0400 Received: by mail-qc0-f182.google.com with SMTP id e16so3966828qcx.27 for ; Sat, 22 Mar 2014 02:43:19 -0700 (PDT) In-Reply-To: <532D0AB1.6080708@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ian Kelling Cc: "emacs-orgmode@gnu.org" Hi Ian On Sat, Mar 22, 2014 at 4:59 AM, Ian Kelling wrote: > I use babel mostly for shell scripts. I wrote a patch to allow toggling the > handling of errors & std err. I prefer standard error just get printed with > everything else, the same as calling a script from a terminal. Doing this properly > with header arguments etc. has been discussed before (google org-babel stderr), > and just hasn't gotten done yet. Until then, this works great, so I'm putting it > out there in case anyone wants to use it. I am generally concerned about respecting the exit status [1] and stderr of a process, also in Org babel [2]. Thank you for taking care of it. > +(defcustom org-babel-use-error-buffer t > + "When evaluating a code block, if nil and an error is returned > +,no error buffer is created and. Standard error > +is redirected to standard out." > +:group 'org-babel > +:version "24.1" > +:type 'boolean) For two reasons I would much prefer if there would be not yet another variable org-* but a header argument or a new value for e. g. ":results": - When someone would use org-babel-use-error-buffer then sharing Org source blocks would be less easy. - With a header argument it would be possible to have different behaviors in different Org source blocks which is also a requirement for backward compatibility of existing source blocks (I would want them to let babel execution still fail in case of a problem). There are also use cases where I would want to capture stderr but let babel execution fail when the exit status is non-zero, see [2]. Michael [1] My shell prompt ($PS1) contains the exit status ($?), my shell scripts contain "set -o errexit; set -o pipefail". [2] See my lengthy post here: http://thread.gmane.org/gmane.emacs.orgmode/45828/focus=46415