[pkg-discuss] Are there any plans to support error codes?
Stephen Hahn
sch at sun.com
Sun Apr 27 09:36:32 PDT 2008
* Rinaldo DiGiorgio <Rinaldo.Digiorgio at sun.com> [2008-04-27 15:45]:
> I was using some of the package commands and the error codes are not
> changing. I can understand how one could say that the commands completed
> and there was no error. Any suggestions on how developers using (sh,
> bash, csh, Beanshell, php.... and the versions of exec in each of those
> languages) gets more detailed completion status. Consider the following
> uninstall, install, install sequence.
>
>
> rinaldo at opensolaris:~# pkg uninstall SUNWzsh
> PHASE ACTIONS
> Removal Phase 817/817
> rinaldo at opensolaris:~# echo $?
> 0
> rinaldo at opensolaris:~# pkg install SUNWzsh
> DOWNLOAD PKGS FILES XFER (MB)
> Completed 1/1 726/726 3.97/3.97
>
> PHASE ACTIONS
> Install Phase 774/774
> rinaldo at opensolaris:~# echo $?
> 0
> rinaldo at opensolaris:~# pkg install SUNWzsh
> Nothing to install in this image (is this package already installed?)
> rinaldo at opensolaris:~# echo $?
> 0
>
> For example the grep command returns different status depending on the
> results of the grep.
>
>
> rinaldo at opensolaris:~# cat /etc/motd
> Sun Microsystems Inc. SunOS 5.11 snv_86 January 2008
> rinaldo at opensolaris:~# grep 11 /etc/motd
> Sun Microsystems Inc. SunOS 5.11 snv_86 January 2008
> rinaldo at opensolaris:~# echo $?
> 0
> rinaldo at opensolaris:~# grep 12 /etc/motd
> rinaldo at opensolaris:~# echo $?
> 1
The analogy here isn't convincing, possibly because the pkg(1)
invocations above are a small subset of those available. pkg
uninstall of an unknown package gives a non-zero exit status; pkg
install of an unknown package gives a non-zero exit status. At the
completion of the pkg install invocation in both the cases above, the
requested package is actually installed.
- Stephen
--
sch at sun.com http://blogs.sun.com/sch/
More information about the pkg-discuss
mailing list