diff --git a/news/2 Fixes/2571.md b/news/2 Fixes/2571.md new file mode 100644 index 000000000000..365e684b43ab --- /dev/null +++ b/news/2 Fixes/2571.md @@ -0,0 +1,2 @@ +Fix bug affecting multiple linters used in a workspace. +(thanks [Ilia Novoselov](https://github.com/nullie)) diff --git a/src/client/common/process/proc.ts b/src/client/common/process/proc.ts index 8ef2a5bda46c..d8ea30ecd2db 100644 --- a/src/client/common/process/proc.ts +++ b/src/client/common/process/proc.ts @@ -168,17 +168,20 @@ export class ProcessService implements IProcessService { } private getDefaultOptions(options: T) : T { - const execOptions = options as SpawnOptions; - const defaultOptions = JSON.parse(JSON.stringify(options)); + const defaultOptions = { ...options }; + const execOptions = defaultOptions as SpawnOptions; if (execOptions) { const encoding = execOptions.encoding = typeof execOptions.encoding === 'string' && execOptions.encoding.length > 0 ? execOptions.encoding : DEFAULT_ENCODING; delete execOptions.encoding; - defaultOptions.encoding = encoding; + execOptions.encoding = encoding; + execOptions.token = execOptions.token; } - if (!defaultOptions.env || Object.keys(defaultOptions).length === 0) { + if (!defaultOptions.env || Object.keys(defaultOptions.env).length === 0) { const env = this.env ? this.env : process.env; defaultOptions.env = { ...env }; + } else { + defaultOptions.env = { ...defaultOptions.env }; } // Always ensure we have unbuffered output. diff --git a/src/test/linters/lint.test.ts b/src/test/linters/lint.test.ts index eafe61da06c9..8413b69f01f3 100644 --- a/src/test/linters/lint.test.ts +++ b/src/test/linters/lint.test.ts @@ -271,17 +271,6 @@ suite('Linting - General Tests', () => { }); // tslint:disable-next-line:no-function-expression test('Multiple linters', async function () { - // Unreliable test being skipped until we can sort it out. See gh-2609. - // - Fails about 1/3 of runs on Windows - // - Symptom: lintingEngine::lintOpenPythonFiles returns values *after* command await resolves in lint.tests - // - lintOpenPythonFiles returns 3 sets of values, not what I expect (1). - // - Haven't yet found a way to await on this properly. - const skipped = true; - if (skipped) { - // tslint:disable-next-line:no-invalid-this - return this.skip(); - } - await closeActiveWindows(); const document = await workspace.openTextDocument(path.join(pythoFilesPath, 'print.py')); await window.showTextDocument(document);