From 4f182d2ef14833880db0da366ff27665490788da Mon Sep 17 00:00:00 2001 From: Thomas Goettlicher Date: Wed, 25 Jul 2007 11:32:26 +0000 Subject: [PATCH] minor changes in machine_readable option --- src/zypper-misc.cc | 7 ++++--- src/zypper-rpm-callbacks.h | 2 +- src/zypper.cc | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/zypper-misc.cc b/src/zypper-misc.cc index 2a0745a..bb7421b 100644 --- a/src/zypper-misc.cc +++ b/src/zypper-misc.cc @@ -1022,9 +1022,10 @@ bool confirm_licenses(bool non_interactive) if (gSettings.license_auto_agree) { // TranslatorExplanation The first %s is name of the resolvable, the second is its kind (e.g. 'zypper package') - cout << format(_("Automatically agreeing with %s %s license.")) - % it->resolvable()->name() % it->resolvable()->kind().asString() - << endl; + if (!gSettings.machine_readable) + cout << format(_("Automatically agreeing with %s %s license.")) + % it->resolvable()->name() % it->resolvable()->kind().asString() + << endl; MIL << format("Automatically agreeing with %s %s license.") % it->resolvable()->name() % it->resolvable()->kind().asString() diff --git a/src/zypper-rpm-callbacks.h b/src/zypper-rpm-callbacks.h index d974d86..8784c37 100644 --- a/src/zypper-rpm-callbacks.h +++ b/src/zypper-rpm-callbacks.h @@ -176,7 +176,7 @@ struct InstallResolvableReportReceiver : public zypp::callback::ReceiveReportname() << endl; else cerr << "Installing: " + to_string (resolvable) << endl; } diff --git a/src/zypper.cc b/src/zypper.cc index 52faa2b..f90d77c 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -1207,9 +1207,18 @@ int safe_one_command(const ZypperCommand & command, int argc, char **argv) } catch (const Exception & ex) { ZYPP_CAUGHT(ex); - cerr << _("Unexpected exception.") << endl; - cerr << ex.asUserString() << endl; - report_a_bug(cerr); + + if (gSettings.machine_readable) + { + cerr << "ERROR:" << _("Unexpected exception.") << endl; + cerr << "ERROR:" << ex.asUserString() << endl; + } + else + { + cerr << _("Unexpected exception.") << endl; + cerr << ex.asUserString() << endl; + report_a_bug(cerr); + } } return ret; } -- 2.7.4