Opened 5 weeks ago

Closed 5 weeks ago

Last modified 5 weeks 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 Changed 5 weeks ago by Even Rouault

Resolution: fixed
Status: newclosed

In 40709:

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

comment:2 Changed 5 weeks ago by Even Rouault

In 40710:

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

comment:3 Changed 5 weeks ago by Even Rouault

Milestone: 2.2.3

comment:4 Changed 5 weeks ago by eschwartz

Wow, thanks for fixing that so fast!

Note: See TracTickets for help on using tickets.