summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-18 15:54:56 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-18 16:32:50 +0000
commiteba2e42855e9413f035e5093d64543184dce6fae (patch)
tree49dd65e174e7d52d8eec4a934c90c833a22797c4 /morphlib
parent46a8e0de14ce2cca4c93ec53648d7e01333bbf65 (diff)
downloadmorph-eba2e42855e9413f035e5093d64543184dce6fae.tar.gz
distbuild: Log in build-step-xx.log files when initiator cancels build
This makes it easier to spot if an incomplete build was due to the user cancelling, or if it represents a dropped connection or internal error.
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/buildcommand.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index a22e689b..c3accf73 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -574,4 +574,12 @@ class InitiatorBuildCommand(BuildCommand):
self.MAX_RETRIES)
loop.add_state_machine(cm)
- loop.run()
+ try:
+ loop.run()
+ except KeyboardInterrupt:
+ # This will run if the user presses Ctrl+C or sends SIGINT during
+ # the build. It won't trigger on SIGTERM, SIGKILL or unhandled
+ # Python exceptions.
+ logging.info('Received KeyboardInterrupt, aborting.')
+ for initiator in loop.state_machines_of_type(distbuild.Initiator):
+ initiator.handle_cancel()