diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c7bb4f665d..4ac73f19fe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Note: Can be used with `megalinter/megalinter@beta` in your GitHub Action mega-l - Correct some broken links in `README` from "Mega-Linter" to "MegaLinter" (#1030) - Docker run -- clean-up containers when exits (#1033) - Add missing Bandit config file and rules path options (#679) +- Fix getting linter version of npm plugin. (#845) - Linters - New linter `phplint` to speed-up linting of php files (#1031) diff --git a/megalinter/Linter.py b/megalinter/Linter.py index b8589c38a80..673a777a79c 100644 --- a/megalinter/Linter.py +++ b/megalinter/Linter.py @@ -696,9 +696,10 @@ def get_linter_version(self): def get_linter_version_output(self): command = self.build_version_command() logging.debug("Linter version command: " + str(command)) + cwd = os.getcwd() if command[0] != "npm" else "~/" try: process = subprocess.run( - command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd ) return_code = process.returncode output = utils.decode_utf8(process.stdout)