Skip to content

Make sure iinfo return code indicates failures for files that won't open #2511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/iinfo/iinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ main(int argc, const char* argv[])
longestname = std::max(longestname, s.length());
longestname = std::min(longestname, (size_t)40);

int returncode = EXIT_SUCCESS;
long long totalsize = 0;
for (auto&& s : filenames) {
auto in = ImageInput::open(s);
Expand All @@ -678,6 +679,7 @@ main(int argc, const char* argv[])
if (err.empty())
err = Strutil::sprintf("Could not open \"%s\"", s);
std::cerr << "iinfo ERROR: " << err << "\n";
returncode = EXIT_FAILURE;
continue;
}
ImageSpec spec = in->spec();
Expand All @@ -692,5 +694,5 @@ main(int argc, const char* argv[])
printf("Total size: %.2f MB\n", t);
}

return 0;
return returncode;
}