NOAA-EMC / wgrib2

Provides functionality for interacting with, reading, writing, and manipulating GRIB2 files.
27 stars 13 forks source link

non-zero error code returned when wgrib2 is called with no arguments #100

Closed edwardhartnett closed 4 months ago

edwardhartnett commented 6 months ago

When I call wgrib2 with no arguments, I get some sensible output, but then it errors with an exit code of 8.

Instead, the return code should be 0.

webisu commented 6 months ago

This is by design.

Suppose $ wgrib2 $file where $file refers to non-existing file. wgrib2 returns a non-zero code

$  wgrib2 $file
     where $file is undefined.
     This is a programming error, so wgrib2  returns a non-zero error

code

$ wgrib2
       This is what wgrib2 sees with the above error.

 $ wgrib2 non-gribfile
        returns 0
        legal grib file

 $ wgrib2 /dev/null
        returns 0
        legal but empty grib file

One could argue that -version, -config, -h, and -help should return a zero error code.

On Wed, Mar 27, 2024 at 10:00 AM Edward Hartnett @.***> wrote:

Assigned #100 https://github.com/NOAA-EMC/wgrib2/issues/100 to @webisu https://github.com/webisu.

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/issues/100#event-12266245542, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZVNTGVPFHYI47I2XZTY2LGGJAVCNFSM6AAAAABFK56MKCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSGI3DMMRUGU2TIMQ . You are receiving this because you were assigned.Message ID: @.***>

edwardhartnett commented 6 months ago

OK, excellent explanation!

Can you look at the open PRs and approve them? Then I will merge them and show you how to encode what you just told me into an automated test...