summaryrefslogtreecommitdiff
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-05-13 16:59:09 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-05-16 16:17:54 +0200
commitfd78974020e23679e9e810cf01dc5c8f3012bb8a (patch)
treeb855e65f5812ff359872295f4f1fe5e62e52e7c8 /apt-private/private-install.cc
parent71203dbf00cbb259fb59e8daf0543a45394b6623 (diff)
show globalerrors before asking for confirmation
Errors cause a kind of automatic no already, but warnings and notices are only displayed at the end of the apt execution even through they could effect the choice of saying yes/no to questions: E.g. if a configuration (file) was ignored you wanted to have an effect or if an external solver you used generated warnings suggesting that the solution might be valid, but bogus non-the-less and similar things. Note that this only moves those messages up to the question if the answer is interactive – not if e.g. -y is used or no question is asked at all so this has an effect only on interactive usage of apt(-get), not script who might be parsing apt output.
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index a4917c5af..44980ceed 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -234,12 +234,12 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
// TRANSLATOR: This string needs to be typed by the user as a confirmation, so be
// careful with hard to type or special characters (like non-breaking spaces)
const char *Prompt = _("Yes, do as I say!");
- ioprintf(c2out,
+ std::string question;
+ strprintf(question,
_("You are about to do something potentially harmful.\n"
"To continue type in the phrase '%s'\n"
" ?] "),Prompt);
- c2out << std::flush;
- if (AnalPrompt(Prompt) == false)
+ if (AnalPrompt(question, Prompt) == false)
{
c2out << _("Abort.") << std::endl;
exit(1);
@@ -256,8 +256,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
if (_config->FindI("quiet",0) < 2 &&
_config->FindB("APT::Get::Assume-Yes",false) == false)
{
- c2out << _("Do you want to continue?") << std::flush;
- if (YnPrompt() == false)
+ if (YnPrompt(_("Do you want to continue?")) == false)
{
c2out << _("Abort.") << std::endl;
exit(1);