diff --git a/package-lock.json b/package-lock.json index 22061cde4..2067caef6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -334,6 +334,15 @@ "@types/node": "*" } }, + "@types/cross-spawn": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/cross-spawn/-/cross-spawn-6.0.1.tgz", + "integrity": "sha512-MtN1pDYdI6D6QFDzy39Q+6c9rl2o/xN7aWGe6oZuzqq5N6+YuwFsWiEAv3dNzvzN9YzU+itpN8lBzFpphQKLAw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", diff --git a/package.json b/package.json index 0089b5948..7e73fc9e2 100644 --- a/package.json +++ b/package.json @@ -1644,6 +1644,7 @@ "dependencies": { "@tamuratak/domstubs": "^0.1.1", "chokidar": "^3.2.3", + "cross-spawn": "^7.0.1", "fs-extra": "^5.0.0", "glob": "^7.1.1", "iconv-lite": "^0.4.24", @@ -1659,6 +1660,7 @@ "ws": "^5.1.1" }, "devDependencies": { + "@types/cross-spawn": "^6.0.1", "@types/fs-extra": "^5.0.0", "@types/glob": "^7.1.1", "@types/micromatch": "^3.0.0", @@ -1674,8 +1676,8 @@ "eslint-plugin-import": "^2.19.1", "husky": "^3.0.2", "npm-run-all": "^4.1.5", - "textmate-bailout": "^1.1.0", "rimraf": "^3.0.0", + "textmate-bailout": "^1.1.0", "typescript": "~3.7.3", "vsce": "^1.69.0", "webpack": "^4.20.2" diff --git a/src/providers/latexformatter.ts b/src/providers/latexformatter.ts index ef1ce56ee..b979c55ee 100644 --- a/src/providers/latexformatter.ts +++ b/src/providers/latexformatter.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode' import * as cp from 'child_process' +import * as cs from 'cross-spawn' import * as path from 'path' import * as fs from 'fs' import * as os from 'os' @@ -141,7 +142,7 @@ export class LaTexFormatter { this.extension.logger.addLogMessage(`Formatting with command ${this.formatter} ${args}`) this.extension.manager.setEnvVar() - const worker = cp.spawn(this.formatter, args, { stdio: 'pipe', cwd: path.dirname(document.fileName) }) + const worker = cs.spawn(this.formatter, args, { stdio: 'pipe', cwd: path.dirname(document.fileName) }) // handle stdout/stderr const stdoutBuffer: string[] = [] const stderrBuffer: string[] = []