All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: 1.7.2 cycle will open soon
Date: Thu, 6 May 2010 02:54:19 -0400	[thread overview]
Message-ID: <20100506065419.GA21009@coredump.intra.peff.net> (raw)
In-Reply-To: <20100506064428.GA29360@progeny.tock>

On Thu, May 06, 2010 at 01:44:28AM -0500, Jonathan Nieder wrote:

> > Am I missing something?
> 
> If cleanup fails, I want to catch it.  Would something like this do?

Ah, I see.

>  test_run_ () {
> 	test_cleanup=:
> 	eval >&3 2>&4 "$1"
> 	eval_ret=$?
> 	eval >&3 2>&4 "$test_cleanup" && (exit "$eval_ret")
> 	eval_ret=$?
> 	return 0
>  }
> 
>  test_when_finished () {
> 	test_cleanup="$* && $test_cleanup"
>  }

Doesn't that violate your rule that the cleanup will _always_ be run?
Here, if the first cleanup fails, we don't run subsequent ones.

Perhaps the simplest would be to just keep a cleanup_ret in the second
eval (where you have eval_ret in the original patch), and then act
appropriately after the eval finishes. That would be easier on the eyes,
too, I think.

> To permit a line break at the end of a cleanup command, one can do
> 
>  test_when_finished () {
> 	test_cleanup="{ $*
> 		} && $test_cleanup"
>  }
> 
> but that might not be worth the ugliness.

I doubt anyone will put a linebreak in, but it is probably better to be
defensive, and the ugliness is at least contained only in that function.

-Peff

  reply	other threads:[~2010-05-06  6:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-05  5:39 1.7.2 cycle will open soon Junio C Hamano
2010-05-06  5:52 ` Jeff King
2010-05-06  6:44   ` Jonathan Nieder
2010-05-06  6:54     ` Jeff King [this message]
2010-05-06  8:41       ` [PATCH] test-lib: some shells do not let $? propagate into an eval Jonathan Nieder
2010-05-06  8:57         ` Jeff King
2010-05-06 20:20           ` Junio C Hamano
2010-05-06  7:06     ` 1.7.2 cycle will open soon Johannes Sixt
2010-05-06  7:49       ` Jeff King
2010-05-06  8:01       ` Jonathan Nieder
2010-05-06  6:57   ` Johannes Sixt

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

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

  git send-email \
    --in-reply-to=20100506065419.GA21009@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.