aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-05 08:10:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-05 08:10:13 +0000
commit372def740a9ab60ed68f0359694657dfd732e1dd (patch)
tree61d9126934691bd57632cb545d0cf7b79e165ddc
parent329adfb4ec54e4d580c5d9e7a80599f0e2d5a6b2 (diff)
downloadpaludis-372def740a9ab60ed68f0359694657dfd732e1dd.tar.gz
paludis-372def740a9ab60ed68f0359694657dfd732e1dd.tar.xz
Catch nested signals more cleanly
-rw-r--r--src/clients/paludis/install.cc38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 0583e05..42bdb04 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -239,17 +239,33 @@ namespace
void
InstallKilledCatcher::_signal_handler(int sig)
{
- cout << endl;
- cerr << "Caught signal " << sig << endl;
- cerr << "Waiting for children..." << endl;
- while (-1 != wait(0))
- ;
- cerr << endl;
- if (_task)
- show_resume_command(*_task);
- cerr << endl;
- cerr << "Exiting with failure" << endl;
- exit(EXIT_FAILURE);
+ static bool recursing(false);
+
+ if (recursing)
+ {
+ cout << endl;
+ cerr << "Caught signal " << sig << " inside signal" << endl;
+ cerr << "NOT waiting for children any more..." << endl;
+ cerr << endl;
+ cerr << "Exiting with failure" << endl;
+ exit(EXIT_FAILURE);
+ }
+ else
+ {
+ recursing = true;
+
+ cout << endl;
+ cerr << "Caught signal " << sig << endl;
+ cerr << "Waiting for children..." << endl;
+ while (-1 != wait(0))
+ ;
+ cerr << endl;
+ if (_task)
+ show_resume_command(*_task);
+ cerr << endl;
+ cerr << "Exiting with failure" << endl;
+ exit(EXIT_FAILURE);
+ }
}
DepListDepsOption