# HG changeset patch # User wenzelm # Date 1361620559 -3600 # Node ID 03d1fca818a434e205a333d3586cd37909cbbd0f # Parent d55cce4d72dde408494bd7fca086e1e67ec113b1 more explicit console interrupt handling; diff -r d55cce4d72dd -r 03d1fca818a4 src/Pure/Tools/build.scala --- a/src/Pure/Tools/build.scala Sat Feb 23 12:28:18 2013 +0100 +++ b/src/Pure/Tools/build.scala Sat Feb 23 12:55:59 2013 +0100 @@ -35,6 +35,10 @@ override def echo(msg: String) { java.lang.System.out.println(msg) } override def theory(session: String, theory: String): Unit = if (verbose) echo(session + ": theory " + theory) + + @volatile private var is_stopped = false + def interrupt_handler[A](e: => A): A = Interrupt.handler { is_stopped = true } { e } + override def stopped: Boolean = { val b = is_stopped; is_stopped = false; b } } @@ -889,9 +893,12 @@ val dirs = select_dirs.map(d => (true, Path.explode(d))) ::: include_dirs.map(d => (false, Path.explode(d))) - build(new Build.Console_Progress(verbose), options, requirements, all_sessions, - build_heap, clean_build, dirs, session_groups, max_jobs, list_files, no_build, - system_mode, verbose, sessions) + val progress = new Build.Console_Progress(verbose) + progress.interrupt_handler { + build(progress, options, requirements, all_sessions, + build_heap, clean_build, dirs, session_groups, max_jobs, list_files, no_build, + system_mode, verbose, sessions) + } case _ => error("Bad arguments:\n" + cat_lines(args)) } }