From ef3f047c07ef0ac4a3a97e6bc11e1c28c6c8f9a0 Mon Sep 17 00:00:00 2001
From: Davies Liu <davies@databricks.com>
Date: Mon, 7 Dec 2015 11:00:25 -0800
Subject: [PATCH] [SPARK-12132] [PYSPARK] raise KeyboardInterrupt inside SIGINT
 handler

Currently, the current line is not cleared by Cltr-C

After this patch
```
>>> asdfasdf^C
Traceback (most recent call last):
  File "~/spark/python/pyspark/context.py", line 225, in signal_handler
    raise KeyboardInterrupt()
KeyboardInterrupt
```

It's still worse than 1.5 (and before).

Author: Davies Liu <davies@databricks.com>

Closes #10134 from davies/fix_cltrc.
---
 python/pyspark/context.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/python/pyspark/context.py b/python/pyspark/context.py
index 77710a1339..529d16b480 100644
--- a/python/pyspark/context.py
+++ b/python/pyspark/context.py
@@ -222,6 +222,7 @@ class SparkContext(object):
         # create a signal handler which would be invoked on receiving SIGINT
         def signal_handler(signal, frame):
             self.cancelAllJobs()
+            raise KeyboardInterrupt()
 
         # see http://stackoverflow.com/questions/23206787/
         if isinstance(threading.current_thread(), threading._MainThread):
-- 
GitLab