Skip to content

Commit c16a769

Browse files
nullied3r3kk
authored andcommitted
Fix multiple linter support (#2571) (#3702)
1 parent ad57393 commit c16a769

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

news/2 Fixes/2571.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix bug affecting multiple linters used in a workspace.
2+
(thanks [Ilia Novoselov](https://github.com/nullie))

src/client/common/process/proc.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,20 @@ export class ProcessService implements IProcessService {
168168
}
169169

170170
private getDefaultOptions<T extends (ShellOptions | SpawnOptions)>(options: T) : T {
171-
const execOptions = options as SpawnOptions;
172-
const defaultOptions = JSON.parse(JSON.stringify(options));
171+
const defaultOptions = { ...options };
172+
const execOptions = defaultOptions as SpawnOptions;
173173
if (execOptions)
174174
{
175175
const encoding = execOptions.encoding = typeof execOptions.encoding === 'string' && execOptions.encoding.length > 0 ? execOptions.encoding : DEFAULT_ENCODING;
176176
delete execOptions.encoding;
177-
defaultOptions.encoding = encoding;
177+
execOptions.encoding = encoding;
178+
execOptions.token = execOptions.token;
178179
}
179-
if (!defaultOptions.env || Object.keys(defaultOptions).length === 0) {
180+
if (!defaultOptions.env || Object.keys(defaultOptions.env).length === 0) {
180181
const env = this.env ? this.env : process.env;
181182
defaultOptions.env = { ...env };
183+
} else {
184+
defaultOptions.env = { ...defaultOptions.env };
182185
}
183186

184187
// Always ensure we have unbuffered output.

src/test/linters/lint.test.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,17 +271,6 @@ suite('Linting - General Tests', () => {
271271
});
272272
// tslint:disable-next-line:no-function-expression
273273
test('Multiple linters', async function () {
274-
// Unreliable test being skipped until we can sort it out. See gh-2609.
275-
// - Fails about 1/3 of runs on Windows
276-
// - Symptom: lintingEngine::lintOpenPythonFiles returns values *after* command await resolves in lint.tests
277-
// - lintOpenPythonFiles returns 3 sets of values, not what I expect (1).
278-
// - Haven't yet found a way to await on this properly.
279-
const skipped = true;
280-
if (skipped) {
281-
// tslint:disable-next-line:no-invalid-this
282-
return this.skip();
283-
}
284-
285274
await closeActiveWindows();
286275
const document = await workspace.openTextDocument(path.join(pythoFilesPath, 'print.py'));
287276
await window.showTextDocument(document);

0 commit comments

Comments
 (0)