diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | doc/whatsnew/2.0.rst | 7 | ||||
-rwxr-xr-x | pylint/epylint.py | 13 |
3 files changed, 20 insertions, 6 deletions
@@ -7,6 +7,12 @@ What's New in Pylint 2.0? Release date: tba + * epylint.py_run's *script* parameter was removed. + + * epylint.py_run now uses ``shell=False`` for running the underlying process. + + Closes #441 + * Added a new warning, 'useless-super-delegation' Close 839. diff --git a/doc/whatsnew/2.0.rst b/doc/whatsnew/2.0.rst index 253ec1d44..11aa517a0 100644 --- a/doc/whatsnew/2.0.rst +++ b/doc/whatsnew/2.0.rst @@ -201,3 +201,10 @@ Removed Changes issue, since the pathological case would have happen when the code was parsed by Python as well, without actually reaching the runtime step and as such, we decided to remove the error altogether. + +* ``epylint.py_run``'s *script* parameter was removed. + + Now ``epylint.py_run`` is always using the underlying ``epylint.lint`` + method from the current interpreter. This avoids some issues when multiple + instances of **pylint** are installed, which means that ``epylint.py_run`` + might have ran a different ``epylint`` script than what was intended. diff --git a/pylint/epylint.py b/pylint/epylint.py index f3cd0d04e..743eecf89 100755 --- a/pylint/epylint.py +++ b/pylint/epylint.py @@ -40,6 +40,7 @@ from __future__ import print_function import os import os.path as osp import sys +import shlex from subprocess import Popen, PIPE import six @@ -102,8 +103,7 @@ def lint(filename, options=None): return process.returncode -def py_run(command_options='', return_std=False, stdout=None, stderr=None, - script='epylint'): +def py_run(command_options='', return_std=False, stdout=None, stderr=None): """Run pylint from python ``command_options`` is a string containing ``pylint`` command line options; @@ -131,9 +131,10 @@ def py_run(command_options='', return_std=False, stdout=None, stderr=None, >>> (pylint_stdout, pylint_stderr) = py_run( 'module_name.py', True) """ # Create command line to call pylint - if os.name == 'nt': - script += '.bat' - command_line = script + ' ' + command_options + epylint_part = [sys.executable, "-c", "from pylint import epylint;epylint.Run()"] + options = shlex.split(command_options) + cli = epylint_part + options + # Providing standard output and/or error if not set if stdout is None: if return_std: @@ -146,7 +147,7 @@ def py_run(command_options='', return_std=False, stdout=None, stderr=None, else: stderr = sys.stderr # Call pylint in a subprocess - process = Popen(command_line, shell=True, stdout=stdout, stderr=stderr, + process = Popen(cli, shell=False, stdout=stdout, stderr=stderr, env=_get_env(), universal_newlines=True) proc_stdout, proc_stderr = process.communicate() # Return standard output and error |