From 53b954f89f2024f51f5f605c8cf99ca0f116b5ad Mon Sep 17 00:00:00 2001 From: Hongbo He Date: Fri, 5 Jan 2018 07:25:37 +0800 Subject: [PATCH] Fix spawn args (#489) Fix fail to generate ctags when there is a space in the path. like #44 #146. We don't need to handle space in the path when the path is passed to child_process.spawn as 'args' (not as the command). --- src/client/workspaceSymbols/generator.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/client/workspaceSymbols/generator.ts b/src/client/workspaceSymbols/generator.ts index 2696e8c6f237..42205f911e2c 100644 --- a/src/client/workspaceSymbols/generator.ts +++ b/src/client/workspaceSymbols/generator.ts @@ -33,11 +33,10 @@ export class Generator implements vscode.Disposable { return await this.generateTags({ directory: this.workspaceFolder.fsPath }); } private buildCmdArgs(): string[] { - const optionsFile = this.optionsFile.indexOf(' ') > 0 ? `"${this.optionsFile}"` : this.optionsFile; const exclusions = this.pythonSettings.workspaceSymbols.exclusionPatterns; const excludes = exclusions.length === 0 ? [] : exclusions.map(pattern => `--exclude=${pattern}`); - return [`--options=${optionsFile}`, '--languages=Python'].concat(excludes); + return [`--options=${this.optionsFile}`, '--languages=Python'].concat(excludes); } @captureTelemetry(WORKSPACE_SYMBOLS_BUILD) private generateTags(source: { directory?: string, file?: string }): Promise { @@ -57,8 +56,7 @@ export class Generator implements vscode.Disposable { if (!fs.existsSync(outputDir)) { fs.mkdirSync(outputDir); } - outputFile = outputFile.indexOf(' ') > 0 ? `"${outputFile}"` : outputFile; - args.push(`-o ${outputFile}`, '.'); + args.push('-o', outputFile, '.'); this.output.appendLine(`${'-'.repeat(10)}Generating Tags${'-'.repeat(10)}`); this.output.appendLine(`${cmd} ${args.join(' ')}`); const promise = new Promise((resolve, reject) => {