File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed
Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Contributors:
88* Alvin Francis (alvinfrancis);
99* Anler Hp (ikame);
1010* Anton Parkhomenko (chuwy);
11+ * Ashley Hewson (ashleyh);
1112* Benjamin Ruston (bruston);
1213* Boris Filippov (frenzykryger);
1314* David Vogt (winged);
Original file line number Diff line number Diff line change 11""" Pylama integration. """
22
33import vim # noqa
4- from .utils import pymode_message
4+ from .utils import pymode_message , silence_stderr
55
66import os .path
77
@@ -31,7 +31,8 @@ def code_check():
3131 vim .command ('return' )
3232 return False
3333
34- errors = check_path (path , options = options )
34+ with silence_stderr ():
35+ errors = check_path (path , options = options )
3536 sort_rules = vim .eval ('g:pymode_lint_sort' )
3637
3738 def sort (e ):
Original file line number Diff line number Diff line change 55
66import vim # noqa
77
8+ try :
9+ from StringIO import StringIO
10+ except ImportError :
11+ from io import StringIO
12+
13+ from contextlib import contextmanager
14+ import threading
15+
816
917PY2 = sys .version_info [0 ] == 2
1018
@@ -123,3 +131,18 @@ def wrapper(*args, **kwargs):
123131 pymode_error (e )
124132 return None
125133 return wrapper
134+
135+
136+ @contextmanager
137+ def silence_stderr ():
138+
139+ """ Redirect stderr. """
140+
141+ with threading .Lock ():
142+ stderr = sys .stderr
143+ sys .stderr = StringIO ()
144+
145+ yield
146+
147+ with threading .Lock ():
148+ sys .stderr = stderr
You can’t perform that action at this time.
0 commit comments