From 80127935df06a829b734cafc2447aa1f3df40288 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 21 Apr 2016 22:04:08 -0700 Subject: [SPARK-10001] [CORE] Interrupt tasks in repl with Ctrl+C ## What changes were proposed in this pull request? Improve signal handling to allow interrupting running tasks from the REPL (with Ctrl+C). If no tasks are running or Ctrl+C is pressed twice, the signal is forwarded to the default handler resulting in the usual termination of the application. This PR is a rewrite of -- and therefore closes #8216 -- as per piaozhexiu's request ## How was this patch tested? Signal handling is not easily testable therefore no unit tests were added. Nevertheless, the new functionality is implemented in a best-effort approach, soft-failing in case signals aren't available on a specific OS. Author: Jakob Odersky Closes #12557 from jodersky/SPARK-10001-sigint. --- repl/scala-2.11/src/main/scala/org/apache/spark/repl/Main.scala | 1 + 1 file changed, 1 insertion(+) (limited to 'repl/scala-2.11/src') diff --git a/repl/scala-2.11/src/main/scala/org/apache/spark/repl/Main.scala b/repl/scala-2.11/src/main/scala/org/apache/spark/repl/Main.scala index b822ff496c..bd853f1522 100644 --- a/repl/scala-2.11/src/main/scala/org/apache/spark/repl/Main.scala +++ b/repl/scala-2.11/src/main/scala/org/apache/spark/repl/Main.scala @@ -88,6 +88,7 @@ object Main extends Logging { } sparkContext = new SparkContext(conf) logInfo("Created spark context..") + Signaling.cancelOnInterrupt(sparkContext) sparkContext } -- cgit v1.2.3