Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7147 closed defect (fixed)

gdal_contour returns exit code 0 on failure

Reported by: eschwartz Owned by: warmerdam
Priority: normal Milestone: 2.2.3
Component: default Version: 2.2.1
Severity: normal Keywords: gdal_contour
Cc:

Description

I'm using gdal_contour to convert a grib file to shapefile. I found that some field names cause gdal_contour to fail (eg. if it contains a hyphen). That's fine -- I can use a different field name. The problem is that the process returns a exit code of 0.

eg:

$ gdal_contour -b 1 -a pressure-msl -nln pressure-msl -i 10000 -off 95000 ./source.grb2 ./out.shp
ERROR 6: Failed to add field named 'pressure-msl'
0...10...20...30...40...50...60...70...80...90...100 - done.

$ echo $?
0

This makes it difficult to handle the error in my code. I would expect that a failure to generate the shapefile would result in an error code >=1

Change History (4)

comment:1 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 40709:

gdal_contour: return with non-0 code if field creation or contour generation failed (fixes #7147)

comment:2 by Even Rouault, 6 years ago

In 40710:

gdal_contour: return with non-0 code if field creation or contour generation failed (fixes #7147)

comment:3 by Even Rouault, 6 years ago

Milestone: 2.2.3

comment:4 by eschwartz, 6 years ago

Wow, thanks for fixing that so fast!

Note: See TracTickets for help on using tickets.