Opened 12 years ago

Closed 12 years ago

#5329 closed Bugs (fixed)

Example program first.cpp returns code 1 in case when program called with "--help" option

Reported by: Vladimir Rutsky <altsysrq@…> Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost Development Trunk Severity: Cosmetic
Keywords: return Cc: Vladimir Rutsky <altsysrq@…>

Description

Hello,

first.cpp example at trunk/libs/program_options/example/first.cpp contains following code at line 30 (r70076):

        if (vm.count("help")) {
            cout << desc << "\n";
            return 1;
        }

That means that program will return non-zero code when called as "./program --help", which usually mean incorrect program termination.

I think outputting help message is a correct program behavior and there should be returned zero code: "return 0".

Best regards, Vladimir Rutsky

Change History (1)

comment:1 by Vladimir Prus, 12 years ago

Resolution: fixed
Status: newclosed

(In [70079]) Return 0, not 1, when --help is passed. Fixes #5329.

Note: See TracTickets for help on using tickets.