-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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. 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

If you don't care about the actual output of the command then you could
just do

    exit_code := $(shell mycommand &> /dev/null ; echo $$?)

In which case you'll get the exit code of mycommand in exit_code.   If
you need the output of the command and the exit code then I'd use a
temporary file to store the exit code like this

    exit_code_file := /tmp/exit_code
    output := $(shell mycommand ; echo $$? > $exit_code_file)
    exit_code := $(shell cat $exit_code_file)

John.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF3BcbLphrp73n/hARAlOcAJ9jS8clp57XJ8ZnGtNkPQEmZH1s3ACgtD6s
X/3ij19jlPgNVExA1btz/uQ=
=awOJ
-----END PGP SIGNATURE-----


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to