-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/7173/#review11706
-----------------------------------------------------------



trunk/qpid/cpp/src/qpidd.cpp
<https://reviews.apache.org/r/7173/#comment25282>

    Wouldn't it be simpler to print the usage message immediately if you see 
the help option? I.e.
            
    options.reset(new QpiddOptions(argv[0]));
    if bootOptions.findArg(arc, argv, help) {
      options->usage();
      return 0;
    }
    
     


- Alan Conway


On Sept. 19, 2012, 4:43 p.m., Chug Rolke wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/7173/
> -----------------------------------------------------------
> 
> (Updated Sept. 19, 2012, 4:43 p.m.)
> 
> 
> Review request for qpid and Alan Conway.
> 
> 
> Description
> -------
> 
> The C++ qpidd broker gets wedged in command line processing during errors. 
> When a parse processing element throws then the exception message printed 
> suggests to use --help. But at that point --help will never work as the code 
> to print help is bypassed by try/catch program flow. This is a customer 
> frustration issue as adding --help like the error message suggests still 
> prints no help message.
> 
> This patch promotes the CLI --version,-v and --help,-h switches to a higher 
> level. 
> * If --version is present then the version number is printed and the broker 
> exits. The CLI args are scanned but not checked for validity.
> * If --help is present then a flag is set. During later processing when a 
> processing element throws then the catch block can know to print help before 
> it passes the exception along.
> 
> The patch checks for --version and --help in the CLI only. Having those 
> switches set in environment variables or the config file are a degenerate 
> cases.
> 
> The command line is parsed multiple times during broker startup. Failures 
> early on will print usage messages different from usage messages that happen 
> after modules are loaded.
> 
> This patch does not rely on any boost::program_options features that are not 
> already in use.
> 
> 
> This addresses bug QPID-3500.
>     https://issues.apache.org/jira/browse/QPID-3500
> 
> 
> Diffs
> -----
> 
>   trunk/qpid/cpp/include/qpid/Options.h 1387614 
>   trunk/qpid/cpp/src/posix/QpiddBroker.cpp 1387614 
>   trunk/qpid/cpp/src/qpid/Options.cpp 1387614 
>   trunk/qpid/cpp/src/qpidd.h 1387614 
>   trunk/qpid/cpp/src/qpidd.cpp 1387614 
>   trunk/qpid/cpp/src/windows/QpiddBroker.cpp 1387614 
> 
> Diff: https://reviews.apache.org/r/7173/diff/
> 
> 
> Testing
> -------
> 
> Passes make test. Compiles and passes on Windows.
> 
> 
> Thanks,
> 
> Chug Rolke
> 
>

Reply via email to