emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: Re: [Babel] No output returned if just one command is failing
Date: Thu, 02 Dec 2010 16:43:59 +0100	[thread overview]
Message-ID: <80d3pkuqm8.fsf@missioncriticalit.com> (raw)
In-Reply-To: 87d3pkialo.fsf@gmail.com

Hi Eric and Dan,

Dan Davison wrote:
> Sébastien Vauban wrote:
>> "Eric Schulte" wrote:
>>> I don't forsee adding partial results insertion both because
>>>
>>> - it would add a good deal of complexity to the code to insert results
>>>   part-way through a run
>>
>> I can't comment on this, of course.
>>
>>> - the current behavior of only inserting results on a fully successful run
>>>   is reasonable and is probably more obvious (at least to me) than
>>>   inserting partial results
>>
>> Being fond of Babel, I'm using it always, everywhere. I prefer:
>>
>> 1. typing my shell commands in an Org buffer,
>> 2. evaluate the block,
>> 3. get the results automagically inserted in the buffer,
>> 4. (eventually, version the whole file for later comparisons when updating
>>    the code),
>> 5. export the whole to HTML and/or PDF.
>>
>> The current behavior, even if totally respectable and defendable, inhibits
>> such a way of working: if you write (or update) a shell code, and don't see
>> (more or less) the same things as the ones you would see in a shell buffer,
>> then you can't use such an Org buffer -- as long as one command fails.
>>
>> I don't especially want you to change your position, but I'm explaining the
>> "negative" consequences for me.
>
> I definitely have some sympathy with your request. On two occasions I've had
> to manually make this change just to carry on working.
>
> But do we actually change babel in this direction? [...]
>
> The thing is that babel currently has a clear, simple, rule which says: if
> there's an error, the result is the elisp value nil.
>
> Eric and I have discussed in the past whether there should be any change
> in this direction. The idea of a :debug header arg has been floated,
> that would allow this behavior. Or tacking stdout on to the error
> output. I tend to think that the behavior you request does need to be
> made available, somehow, whether by default or not.

If find this conclusion a bit contradictory with the fact that you even needed
it yourself. I'm not talking of having this by default, but somehow possible.
But, I know, we (you) have to ensure everything stays coherent, and somehow
simple...

BTW, what's the internal "definition" (in Org Babel) of "unsuccessful run" of
a (sh) command block?

Is it "return code != 0"?

If yes, such a sh block would never produce any results when the machine is
not a known name (as first command would "fail"):

#+begin_src sh :var machine :results output
ping $machine
rc=$?
if [ $rc == 0 ]; then
    echo "Machine pinged successfully with its name...";
else
    echo "Trying to ping machine by its IP...";
    ipmachine=$(grep whichever-list.txt | cut -f 2);
    ping $ipmachine
fi
#+end_src

(the above is just a simply sample of code which includes tests of rc)

Though, it does currently work with both known and unknown machines. So I'm
clearly missing something here.

Best regards,
  Seb

PS- I already sent this (the last paragraphs) hours ago. It did not reach the
    ML. Is it a Gmane problem?  Or something else (Gnus)?

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  parent reply	other threads:[~2010-12-02 15:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01  9:25 [Babel] No output returned if just one command is failing Sébastien Vauban
2010-12-01 14:29 ` Eric Schulte
2010-12-01 15:25   ` Sébastien Vauban
2010-12-02 10:03     ` Sébastien Vauban
2010-12-02 13:10     ` Dan Davison
2010-12-02 14:35       ` Eric Schulte
2010-12-02 20:34         ` Sébastien Vauban
2010-12-02 15:43       ` Sébastien Vauban [this message]
2010-12-02 18:02         ` Dan Davison
2010-12-02 20:27           ` Sébastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80d3pkuqm8.fsf@missioncriticalit.com \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).