Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: exit status problem

On Dec 4,  2:03am, Vincent Lefevre wrote:
}   A backgrounded pipeline returns a status of zero.
} It seems to be a bug in zsh 4.3.10 that has been fixed in the latest
} dev versions. Do you have more information?

It was a bug at least as far back as 4.2.0.  Backgrounded jobs appear
not to have changed the foreground status until sometime post-4.3.10,
but I'm not finding a likely-looking ChangeLog entry unless this fix
was a side-effect of adding POSIX_JOBS behavior.  Or maybe it's this:

	* users/15217: Src/Zle/zle_main.c: use top-level status
	when redrawing prompt.

} Back to my original problem, I can reproduce it with the dev version,
} using:
} 1. I type "false".
} 2. I type "sleep 5 &".
} 3. I type "false".
} 4. I increase the window width.
} 5. I type [Enter].

The status you're displaying is $? stored in psvar[1], correct?  And
that's set by precmd, and you're explicitly calling precmd again on
TRAPCLD, rather than allowing it to be called in the proper context
with global status manipulated as it would be at hook time.

If I use %? instead, I get consistent behavior, that is, the status
shown in the prompt never changes on window resize.  So I have to
conclude that this is an effect you've introduced.

It's too bad it's necessary to construct such a ridiculously elaborate
chain of %?(.t.f) conditions to get the effect your precmd creates in

  local x y z
  for x in {1..255}
    if (( x > 128 ))
    then y+="%$x(?.${signals[x-127]:-$x}."
    else y+="%$x(?.$x."

Messages sorted by: Reverse Date, Date, Thread, Author