summaryrefslogtreecommitdiff
path: root/module/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-03 14:58:55 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-03 15:01:58 +0200
commit2da97f1c7c0748509180308d9e6a817bc49172e7 (patch)
tree504f2c6cf429da827752db91e6be3fa50e8c20c8 /module/scripts
parenta5186f506f69ef8a8accd234ca434efd13f302c9 (diff)
downloadguile-2da97f1c7c0748509180308d9e6a817bc49172e7.tar.gz
'guild compile' doesn't leave temporary files behind it.
* module/scripts/compile.scm (compile): Add 'sigaction' call. * test-suite/standalone/test-guild-compile: New file. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
Diffstat (limited to 'module/scripts')
-rw-r--r--module/scripts/compile.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/module/scripts/compile.scm b/module/scripts/compile.scm
index 20db94463..0a2ca4d23 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -1,6 +1,6 @@
;;; Compile --- Command-line Guile Scheme compiler -*- coding: iso-8859-1 -*-
-;; Copyright 2005,2008,2009,2010,2011 Free Software Foundation, Inc.
+;; Copyright 2005, 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
@@ -176,6 +176,14 @@ Report bugs to <~A>.~%"
(fail "`-o' option can only be specified "
"when compiling a single file"))
+ ;; Install a SIGINT handler. As a side effect, this gives unwind
+ ;; handlers an opportunity to run upon SIGINT; this includes that of
+ ;; 'call-with-output-file/atomic', called by 'compile-file', which
+ ;; removes the temporary output file.
+ (sigaction SIGINT
+ (lambda args
+ (fail "interrupted by the user")))
+
(for-each (lambda (file)
(format #t "wrote `~A'\n"
(with-fluids ((*current-warning-prefix* ""))