summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2013-02-20 19:23:43 +0100
committerFlorent Xicluna <florent.xicluna@gmail.com>2013-02-20 19:23:43 +0100
commita663c2a2df35a09e9ec41460b5e5905ec16f576f (patch)
treeaebc40837420cc7330dc5d956017cff9b0975c57
parent4721b9dc22ba38fd13fc658c376462a167698b1c (diff)
parent8ddbc277c15d1abbb5f6f04ed03d0e722a617b6a (diff)
downloadpep8-a663c2a2df35a09e9ec41460b5e5905ec16f576f.tar.gz
Merge branch 'graceful-stop'
-rw-r--r--CHANGES.txt2
-rwxr-xr-xpep8.py13
2 files changed, 10 insertions, 5 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 4dc5631..ef70009 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,8 @@ Changelog
* Read from standard input if no path is specified.
+* Initiate a graceful shutdown on ``Control+C``.
+
1.4.2 (2013-02-10)
------------------
diff --git a/pep8.py b/pep8.py
index e571751..039c714 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1603,11 +1603,14 @@ class StyleGuide(object):
report = self.options.report
runner = self.runner
report.start()
- for path in paths:
- if os.path.isdir(path):
- self.input_dir(path)
- elif not self.excluded(path):
- runner(path)
+ try:
+ for path in paths:
+ if os.path.isdir(path):
+ self.input_dir(path)
+ elif not self.excluded(path):
+ runner(path)
+ except KeyboardInterrupt:
+ print('... stopped')
report.stop()
return report