Qixiang Wan
2010-Mar-31 14:49 UTC
[Libguestfs] The exit code makes user confused while using '-' prefixed subcommands
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 > EOFblabla: 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.
Richard W.M. Jones
2010-Apr-01 12:49 UTC
[Libguestfs] The exit code makes user confused while using '-' prefixed subcommands
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/