If we receive an interrupt, set a flag and do not abort
immediately without waiting for the child. Once the child
exited, exit with an error if the interrupted flag is set.
Closes: #832593
bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
{
bool result = true;
+ static bool interrupted = false;
Configuration::Item const *Opts = _config->Tree(Cnf);
if (Opts == 0 || Opts->Child == 0)
Opts = Opts->Child;
sighandler_t old_sigpipe = signal(SIGPIPE, SIG_IGN);
+ sighandler_t old_sigint = signal(SIGINT, [](int signum){
+ interrupted = true;
+ });
unsigned int Count = 1;
for (; Opts != 0; Opts = Opts->Next, Count++)
break;
}
}
+ signal(SIGINT, old_sigint);
signal(SIGPIPE, old_sigpipe);
+ if (interrupted)
+ result = _error->Error("Interrupted");
+
return result;
}
/*}}}*/