mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jan Weitzel <J.Weitzel@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [Patch] hush exit code fix
Date: Fri, 12 Mar 2010 10:01:33 +0100	[thread overview]
Message-ID: <20100312090133.GP19843@pengutronix.de> (raw)
In-Reply-To: <1267786310.19729.11.camel@lws-weitzel>

Hi Jan,

On Fri, Mar 05, 2010 at 11:51:50AM +0100, Jan Weitzel wrote:
> hush: pass return code from exit command within if statement
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
> diff --git a/common/hush.c b/common/hush.c
> index cf6704b..ae09374 100644
> --- a/common/hush.c
> +++ b/common/hush.c
> @@ -535,10 +535,9 @@ static int run_pipe_real(struct pipe *pi)
>         if (pi->num_progs == 1)
>                 child = & (pi->progs[0]);
>         if (pi->num_progs == 1 && child->group) {
> -               int rcode;
>                 debug("non-subshell grouping\n");
> -               rcode = run_list_real(child->group);
> -               return rcode;
> +               run_list_real(child->group);
> +               return last_return_code;
>         } else if (pi->num_progs == 1 && pi->progs[0].argv != NULL) {
>                 for (i=0; is_assignment(child->argv[i]); i++) { /* nothing */ }
>                 if (i!=0 && child->argv[i]==NULL) {
> 
> 
> 

This does not solve the problem and introduces a new one:

barebox:/ cat /env/bin/bar
false
if [ $? != 0 ]; then
        echo tschuess
        exit
fi

echo hallo

barebox:/ bar
tschuess
hallo
barebox:/


Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2010-03-12  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-05 10:51 Jan Weitzel
2010-03-12  9:01 ` Sascha Hauer [this message]

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=20100312090133.GP19843@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=J.Weitzel@phytec.de \
    --cc=barebox@lists.infradead.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