qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qemu-img: Exit with code 0 if there is no error


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] qemu-img: Exit with code 0 if there is no error
Date: Tue, 22 Apr 2014 09:02:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Michael Tokarev <address@hidden> writes:

> 18.04.2014 18:29, Eric Blake wrote:
>> On 04/18/2014 12:23 AM, Fam Zheng wrote:
>>> Signed-off-by: Fam Zheng <address@hidden>
>>> ---
>>>  qemu-img.c | 68
>>> +++++++++++++++++++++++++++++++-------------------------------
>>>  1 file changed, 34 insertions(+), 34 deletions(-)
>>>
>> 
>>>  /* Please keep in synch with qemu-img.texi */
>>> -static void help(void)
>>> +static void help(bool error)
>> 
>> This doesn't intuitively tell me whether 'true' is success (0 status) or
>> failure (non-zero status).
>> 
>>>  {
>>>      const char *help_msg =
>>>             "qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 
>>> Fabrice Bellard\n"
>>> @@ -129,7 +129,7 @@ static void help(void)
>>>      printf("%s\nSupported formats:", help_msg);
>>>      bdrv_iterate_format(format_print, NULL);
>>>      printf("\n");
>>> -    exit(1);
>>> +    exit(error ? 1 : 0);
>> 
>> Oh - true for failure.  I'd MUCH rather see:
>
> As I already pointed out in a comment for similar patch for ./configure,
> maybe it is better to _not_ print help output in case of error, because
> this way, the most important error message scrolls up the screen replaced
> by the help text.  Instead, it might be better to say something like,
>
>   run ./qemu-img --help for list of available options
>
> and exit non-zero in case of some option error instead of printing
> whole help text.  This way, there's no need to pass anything to the
> help() function.

Agreed.  A one-liner pointing out how to get help is welcome, more than
that not so much.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]