ECC-779: Error 'no messages found in ...' should go to stderr

This commit is contained in:
Shahram Najm 2020-11-06 12:06:40 +00:00
parent 5c05990860
commit efe95c52f5
2 changed files with 8 additions and 7 deletions

View File

@ -32,9 +32,9 @@ tempOut=temp.$label.$$.out
tempRef=temp.$label.$$.ref
${tools_dir}/grib_index_build -N -o $tempIndex ${infile} >/dev/null
# Must remove first two lines and the last (filename specifics)
${tools_dir}/grib_dump -D ${tempIndex} | sed '1,2d' | sed '$d' > $tempOut
cat $tempOut
# Must remove first two lines (filename specifics)
${tools_dir}/grib_dump ${tempIndex} | sed '1,2d' > $tempOut
#cat $tempOut
cat > $tempRef <<EOF
Index keys:
@ -97,8 +97,8 @@ ${tools_dir}/grib_index_build -N -k mars.levtype -o $tempIndex ${data_dir}/tigge
${tools_dir}/grib_index_build -N -k mars.levtype:i -o $tempIndex ${data_dir}/tigge_cf_ecmwf.grib2 |\
grep -q "mars.levtype = { 103, 1, 106, 100, 101, 8, 109, 107 }"
# grib_compare with index files
# -----------------------------
echo "grib_compare with index files..."
# ------------------------------------
tempIndex1=temp.$label.$$.1.idx
tempIndex2=temp.$label.$$.2.idx
tempGribFile1=temp.$label.$$.file1.grib

View File

@ -295,6 +295,7 @@ static int grib_tool_with_orderby(grib_runtime_options* options)
grib_handle_delete(h);
}
if (set->size==0) fprintf(stderr, "no messages found in fieldset\n");
grib_tool_finalise_action(options);
grib_fieldset_delete(set);
@ -416,7 +417,7 @@ static int grib_tool_without_orderby(grib_runtime_options* options)
fclose(infile->file);
if (infile->handle_count == 0) {
fprintf(dump_file, "no messages found in %s\n", infile->name);
fprintf(stderr, "no messages found in %s\n", infile->name);
if (options->fail)
exit(1);
}
@ -733,7 +734,7 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle
if (ns) {
kiter = grib_keys_iterator_new(h, 0, ns);
if (!kiter) {
fprintf(dump_file, "ERROR: Unable to create keys iterator\n");
fprintf(stderr, "ERROR: Unable to create keys iterator\n");
exit(1);
}