Skip to content

Fix regressions from stderr/stdout changes #1677

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
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dnf5/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ void Context::Impl::download_and_run(libdnf5::base::Transaction & transaction) {
print_error(entry);
}
for (auto & problem : transaction.get_transaction_problems()) {
print_error(problem);
print_error(fmt::format(" - {}", problem));
}
throw libdnf5::cli::SilentCommandExitError(1);
}
Expand Down
14 changes: 7 additions & 7 deletions dnf5/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,12 +1406,13 @@ int main(int argc, char * argv[]) try {
context.download_and_run(*context.get_transaction());
}
} catch (libdnf5::cli::GoalResolveError & ex) {
context.print_error(ex.what());
std::cerr << ex.what() << std::endl;
if (!any_repos_from_system_configuration && base.get_config().get_installroot_option().get_value() != "/" &&
!base.get_config().get_use_host_config_option().get_value()) {
context.print_error(
"No repositories were loaded from the installroot. To use the configuration and repositories "
"of the host system, pass --use-host-config.");
std::cerr
<< "No repositories were loaded from the installroot. To use the configuration and repositories "
"of the host system, pass --use-host-config."
<< std::endl;
} else {
if (context.get_transaction() != nullptr) {
// download command can throw GoalResolveError without context.transaction being set
Expand All @@ -1420,11 +1421,10 @@ int main(int argc, char * argv[]) try {
}
return static_cast<int>(libdnf5::cli::ExitCode::ERROR);
} catch (libdnf5::cli::ArgumentParserError & ex) {
context.print_error(
fmt::format("{}{}", ex.what(), _(". Add \"--help\" for more information about the arguments.")));
std::cerr << ex.what() << _(". Add \"--help\" for more information about the arguments.") << std::endl;
return static_cast<int>(libdnf5::cli::ExitCode::ARGPARSER_ERROR);
} catch (libdnf5::cli::CommandExitError & ex) {
context.print_error(ex.what());
std::cerr << ex.what() << std::endl;
return ex.get_exit_code();
} catch (libdnf5::cli::SilentCommandExitError & ex) {
return ex.get_exit_code();
Expand Down
Loading