On Wed, 2007-02-21 at 01:18 -0500, David Boyce wrote: > How does one determine the exit status of the shell forked by $(shell > ...)? I see nothing about it in the 3.81 online manual.
The short answer is that there's no way to retrieve the exit code via make itself. Others have mentioned things like "echo $?" or using a temporary file. > I need to run a command for which the null string is a perfectly legal > output value, so I can't get away with anything like this: > > foo := $(shell mycommand) > > ifeq($foo),) > <code to handle error conditions> > endif > > And I don't just need to abort on error either. If the command fails I > have another (slower and less reliable) way to get the data whereas if > it succeeds with null output I want to continue on happily. Which > means I need exit status. Is this an oversight in the spec? I'm not sure about your situation exactly but something like this is much simpler to do within the shell: foo := $(shell mycommand || slow-less-reliable-command) or similar. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
