This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash returns incorrect process status


On 16 Sep, Pierre A. Humblet wrote:
>  But bash seems to keep at least CHILD_MAX jobs, each one of them possibly 
>  with many (unbounded) processes. It is very easy to produce situations 
>  where bash keeps track of thousands of pids. Many of those pids (e.g. the 
>  first ones in pipelines) will have been waited on, and nothing prevents the 
>  OS from reusing them. Pid aliasing can easily occur even if the OS never 
>  reuses a pid in CHILD_MAX consecutive forks from a process. 

I'm coming in to this discussion late, and this is probably way off
topic.  But I once thought bash wasn't reporting status of the previous
command properly (as reported via $?), when what was really happening
was that I was executing other commands as part of my bash prompt, and
bash was reporting the (successful) status of the last of those
commands!

I.e. I'd get a different result by doing:

    some-command
    if [ $? = 0 ]
    then ...

and doing

    some-command && ...

luke


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]