summaryrefslogtreecommitdiff
path: root/apt-private/private-sources.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-sources.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-sources.cc')
-rw-r--r--apt-private/private-sources.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc
index 6a32931ba..5f61a23ab 100644
--- a/apt-private/private-sources.cc
+++ b/apt-private/private-sources.cc
@@ -30,7 +30,6 @@ bool EditSources(CommandLine &CmdL)
{
bool res;
pkgSourceList sl;
- std::string outs;
std::string sourceslist;
if (CmdL.FileList[1] != NULL)
@@ -48,28 +47,25 @@ bool EditSources(CommandLine &CmdL)
int lockfd = GetLock(sourceslist);
if (lockfd < 0)
return false;
-
+
do {
EditFileInSensibleEditor(sourceslist);
_error->PushToStack();
res = sl.Read(sourceslist);
if (!res) {
- _error->DumpErrors(std::cerr, GlobalError::DEBUG, false);
- strprintf(outs, _("Failed to parse %s. Edit again? "),
- sourceslist.c_str());
- std::cout << outs;
+ std::string outs;
+ strprintf(outs, _("Failed to parse %s. Edit again? "), sourceslist.c_str());
// FIXME: should we add a "restore previous" option here?
- res = !YnPrompt(true);
+ res = !YnPrompt(outs.c_str(), true);
}
_error->RevertToStack();
} while (res == false);
close(lockfd);
if (FileExists(sourceslist) && !before.VerifyFile(sourceslist)) {
- strprintf(
- outs, _("Your '%s' file changed, please run 'apt-get update'."),
+ ioprintf(
+ std::cout, _("Your '%s' file changed, please run 'apt-get update'."),
sourceslist.c_str());
- std::cout << outs << std::endl;
}
return true;