On Jun 16, 2009, at 12:01 PM, Nicolas Williams wrote:
On Tue, Jun 16, 2009 at 09:57:08AM -0700, Danek Duvall wrote:
On Tue, Jun 16, 2009 at 11:39:37AM -0500, Nicolas Williams wrote:

Besides, I'm not sure if I really want to have "install -n[v]" be
parseable.

Huh?

If "pkg install -n" were to tell you that a reboot would be required (as Venky had mentioned earlier), then in order to use that in a script, the output of the command would need to be Committed, hence parseable in some form. If all you care about is human-readable messaging, then I don't see
any problems with it.

A well-defined exit status code will do.

pkg install -n foo > $tmpfile 2>&1

case $? in
        # Done!
        0) : ;;
        # Reboot required, tell the user/do whatever, try again
        $IPS_REBOOT_REQD) ...;;
        # Oops, something went wrong, show the user pkg's output, ...
        *) ...;;
esac


For the same reasons we don't use exit codes to indicate specific failure reasons, I'd rather not use them to indicate specific success or actions.

I especially don't want to end up some day with a bitmap masked return code :)

A formal, committed, parse-able output format is preferable to abusing exit codes.

--
Shawn Walker
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to