git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Pavel Roskin <proski@gnu.org>
Cc: git <git@vger.kernel.org>
Subject: Re: [COGITO PATCH] Fixing "cg-help typo" again
Date: Wed, 15 Jun 2005 01:43:33 +0200	[thread overview]
Message-ID: <20050614234333.GA17152@diku.dk> (raw)
In-Reply-To: <1118791967.3890.11.camel@dv>

Pavel Roskin <proski@gnu.org> wrote Tue, Jun 14, 2005:
> Hello!

Hi,

> "cg-help typo" is broken again (same symptom - no output) because the
> print_help() output is piped through colorize(), which never fails.

Sorry, I broke it in the cg-help colorization patch, and has already
sent a patch to pasky, off-list I am afraid ...
> 
> I don't know any way to get return status of the first command in a
> pipeline, so I changed to code to put print_help() output in a variable,
> check status and then pipe the variable contents through colorize().

Use the PIPESTATUS aray as in the patch I sent:

@@ -59,7 +59,8 @@ colorize() {
 
 if [ "$ARGS" ]; then
 	cmd=$(echo "${ARGS[0]}" | sed 's/^cg-//')
-	( print_help $cmd | colorize ) && exit
+	print_help $cmd | colorize
+	[ "${PIPESTATUS[0]}" -eq 0 ] && exit
 	echo "cg-help: no help available for command \"${ARGS[0]}\""
 	echo "Call cg-help without any arguments for the list of available commands"
 	exit 1

-- 
Jonas Fonseca

  reply	other threads:[~2005-06-14 23:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-14 23:32 [COGITO PATCH] Fixing "cg-help typo" again Pavel Roskin
2005-06-14 23:43 ` Jonas Fonseca [this message]
2005-06-15  0:17   ` Pavel Roskin

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=20050614234333.GA17152@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=proski@gnu.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.
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 NNTP newsgroup(s).