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

Re: PRINT_EXIT_VALUE problems



[I suggest further discussion go to zsh-workers rather than -users.]

On Dec 24, 12:13pm, Vincent Lefevre wrote:
}
} xvii% setopt PRINT_EXIT_VALUE
} xvii% false || true
} zsh: exit 1
} 
} 1. I don't think the value should be printed in the case of a program
} before ||, because the goal of || is to ignore or handle the error.

Hrm.  This is a bit problematic.  The call stack is something like
this (deepest frame at bottom):

	execode()
	execlist()	<- here we know the state of "&&"/"||"
	execpline()	<- here we print exit of external jobs [*]
	execpline2()
	execcmd()	<- here we print exit of builtins/functions

[*] which really happens via the SIGCHLD handler, but we wait there.

So in order to suppress printing on the left side of "||", execlist()
will need to record that state in a location that can be read both
from printjob() as called by the signal handler, and from execcmd();
or, we need to pull this out of both of those places and put it into
execlist().

} 2. Here zsh doesn't say which program failed. I suppose that the
} problem is due to the fact that "false" is a builtin.

This actually might be easier to fix, execcmd() should be able to get
the name of the function or builtin it was executing.



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