Usage messages not being sent to Standard Error

5 views
Skip to first unread message

Bhavesh Sanghvi

unread,
Jul 20, 2008, 8:26:18 PM7/20/08
to openb...@googlegroups.com

Hello,

 

In case I miss to use a mandatory option, I get a message something like this:

Mandatory option(s) missing: ...

 

Usage: java task. …

 

I just wanted to bring this to notice, that in this case, the system does not terminate with a non-zero return value. Also this message is not being sent to standard error. It is being sent to standard output. Is this a bug? If not, is it still possible to modify both (non-zero return value and usage message on standard error)?

 

--

Best,

Bhavesh Sanghvi

Lúcio de Souza Coelho

unread,
Jul 21, 2008, 1:39:46 PM7/21/08
to openb...@googlegroups.com
I tend to think of those consistency check/syntax error/usage messages
as features of the CLI, so I usually show them through standard
output. But then, that is just a conceptual quirk of mine, and I
wouldn't mind changing that to standard error instead. Would that help
your work with the GUI in some way?

Bhavesh Sanghvi

unread,
Jul 22, 2008, 12:03:51 PM7/22/08
to openb...@googlegroups.com

Sorry for the delay in the response, but yes, it will help me. The application uses the return value to decide whether or not the command executed properly or not.

1.       For the time, the command is being executed, only the output stream is being read and the messages are displayed on progress bar as well as being stored in a temporary file. At the closing of output stream, the application assumes that command has terminated.

2.       On receiving a zero return value, application assumes that the command executed properly. Then,

a.       A project is created and it contains all the input and output files.

b.      The temporary file (containing output stream messages) is stored as execution.log file in the project.

c.       The error stream is ignored. If required, I can still display it on console (I just thought there is no need).

3.       On receiving any non-zero return value, application assumes that the command did not executed properly. Then,

a.       No, project is created.

b.      The temporary file (containing output stream messages) is discarded. If required, I can still display it on console (I just thought there is no need).

c.       The error stream is displayed on the console.

 

Hence, on receiving less arguments or any other error (e.g. a file with invalid data), if the message is shown on error stream and a non-zero value is returned, then the GUI will be more accurate. I think for the error case, it is already happening, but I have not tested much for various kinds of errors.

 

I also thought about a scenario in which user specifically wants to know the usage, say on using “/?” argument. In this case, please continue using zero return value and displaying the messages on output stream.

 

--

Best,

Bhavesh Sanghvi

 

 

-----Original Message-----

From: openb...@googlegroups.com [mailto:openb...@googlegroups.com] On Behalf Of Lúcio de Souza Coelho

Sent: Monday, July 21, 2008 12:40 PM

To: openb...@googlegroups.com

Subject: Re: Usage messages not being sent to Standard Error

Lúcio de Souza Coelho

unread,
Jul 22, 2008, 1:12:56 PM7/22/08
to openb...@googlegroups.com
Ok, I will refactor the code and direct the usage messages to standard
error; following your suggestion, I will also likely include a -help
option for all commands in case the user explicitly wants to know the
syntax thought the CLI, and then standard output would be used.

A new jar containing those changes will be made available soon.

On Tue, Jul 22, 2008 at 1:03 PM, Bhavesh Sanghvi

Lúcio de Souza Coelho

unread,
Jul 28, 2008, 5:30:18 PM7/28/08
to openb...@googlegroups.com
On Tue, Jul 22, 2008 at 2:12 PM, Lúcio de Souza Coelho <luc...@gmail.com> wrote:
> Ok, I will refactor the code and direct the usage messages to standard
> error; following your suggestion, I will also likely include a -help
> option for all commands in case the user explicitly wants to know the
> syntax thought the CLI, and then standard output would be used.
>
> A new jar containing those changes will be made available soon.
(...)

A new jar (version 0.71) is available at the OpenBiomind project site.
All error/consistency check messages of all commands are now being
sent to Standard Error. I have not included yet the explicit -help
option in that release.

Bhavesh Sanghvi

unread,
Aug 2, 2008, 6:53:33 PM8/2/08
to openb...@googlegroups.com
Thanks Lúcio. The messages are now coming on the Standard error.
However, it still returns 0 as the return value. Is it possible to return
any non zero value?
I'll need this value, as this enables me to decide whether the command
executed properly or not.

--
Thanks,
Bhavesh Sanghvi

-----Original Message-----
From: openb...@googlegroups.com [mailto:openb...@googlegroups.com] On
Behalf Of Lúcio de Souza Coelho
Sent: Monday, July 28, 2008 4:30 PM
To: openb...@googlegroups.com
Subject: Re: Usage messages not being sent to Standard Error


Lúcio de Souza Coelho

unread,
Sep 2, 2008, 5:47:31 PM9/2/08
to openb...@googlegroups.com
Hi Bhavesh,

I've finally de-queued that task (sorry for the month-long delay!) and
now in OpenBiomind 0.74 all commands are refactored for returning -1
in case of improper execution.

Bhavesh Sanghvi

unread,
Sep 4, 2008, 8:32:31 PM9/4/08
to openb...@googlegroups.com
Thanks Lúcio. I'll use it and let you know in case of any issue.
Reply all
Reply to author
Forward
0 new messages