[Libguestfs] The exit code makes user confused while using '-' prefixed subcommands

Richard W.M. Jones rjones at redhat.com
Thu Apr 1 12:49:02 UTC 2010


On Wed, Mar 31, 2010 at 10:49:47AM -0400, Qixiang Wan wrote:
> guestfish returns 0 if the commands completed without error, or 1 if there was an error.
> But the rule break when we use '-' prefix subcommands:
> ------------------------------------
> $ guestfish <<\EOF
> > blabla
> > EOF
> blabla: unknown command
> $ echo $?
> 1
> $ guestfish <<\EOF
> -blabla
> EOF
> blabla: unknown command
> $ echo $?
> 0
> ------------------------------------
> 
> I think it should be more reasonable to make the behaviours keeping identical with the rule.

As I said on IRC, '-' means 'ignore the error', which (I think) means
that we shouldn't return an error status code either.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list