summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-07-15 10:59:11 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-07-26 19:07:55 +0200
commitb1165a67b1f47f64082fce9a4af80838a2f5e55c (patch)
treef5e83e33b8ed9bb0965fdc7838ff903e66fd9bd6 /cmdline
parent49a81c237e18775a10369feaec303881f377bb6a (diff)
ignore SIGPIPE in dump solver if forwarding
Our test-external-dependency-solver-protocol test sometimes fails on the immediately 'crashing' solver exit1withoutmsg with the message that it got SIGPIPE from the solver. That isn't really possible as the solver produces no output, but on inspection its not this solver getting the signal but the wrapping provided by the dump-solver as the wrapped solver instantly exits. Simply ignoring the signal helps in perhaps extracting the last words of another solver (as this one has none), but at the very least we get the exit code of the wrapped solver we interested in as output.
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-dump-solver.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc
index e94021fcf..24a9f23eb 100644
--- a/cmdline/apt-dump-solver.cc
+++ b/cmdline/apt-dump-solver.cc
@@ -99,6 +99,7 @@ int main(int argc,const char *argv[]) /*{{{*/
FileFd forward;
if (is_forwarding_dumper)
{
+ signal(SIGPIPE, SIG_IGN);
int external[] = {-1, -1};
if (pipe(external) != 0)
return 250;
@@ -154,13 +155,6 @@ int main(int argc,const char *argv[]) /*{{{*/
forward.Close();
dump.Close();
- if (_error->PendingError())
- {
- std::ostringstream out;
- out << "Writing EDSP solver input to file '" << filename << "' failed due to write errors!\n";
- return WriteError("ERR_WRITE_ERROR", out, stdoutfd, Solver);
- }
-
if (is_forwarding_dumper)
{
// Wait and collect the error code
@@ -179,6 +173,12 @@ int main(int argc,const char *argv[]) /*{{{*/
else
return 255;
}
+ else if (_error->PendingError())
+ {
+ std::ostringstream out;
+ out << "Writing EDSP solver input to file '" << filename << "' failed due to write errors!\n";
+ return WriteError("ERR_WRITE_ERROR", out, stdoutfd, Solver);
+ }
else
EDSP::WriteError("ERR_JUST_DUMPING", "I am too dumb, i can just dump!\nPlease use one of my friends instead!", stdoutfd);
return 0;