aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bbot/agent/machine.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/bbot/agent/machine.cxx b/bbot/agent/machine.cxx
index f3c9874..c2ded27 100644
--- a/bbot/agent/machine.cxx
+++ b/bbot/agent/machine.cxx
@@ -338,7 +338,26 @@ namespace bbot
// Wait for up to the specified number if seconds for the machine to
// shutdown.
//
- return wait (seconds);
+ // Since things sometimes get stuck for no apparent reason, keep repeating
+ // the the request every minute.
+ //
+ for (size_t s;; )
+ {
+ s = 60;
+ bool r (seconds < s ? wait (seconds) : wait (s));
+ seconds -= (60 - s);
+
+ if (r || seconds == 0)
+ return r;
+
+ try
+ {
+ monitor_command ("system_powerdown", false);
+ }
+ catch (const failed&) {}
+ }
+
+ return false;
}
void kvm_machine::