@@ -2,7 +2,7 @@ import { fileURLToPath } from "url";
22import { RequestMessage } from "vscode-languageserver" ;
33import * as utils from "./utils" ;
44import * as path from "path" ;
5- import { execSync } from "child_process" ;
5+ import { execFileSync } from "child_process" ;
66import fs from "fs" ;
77
88let binaryPath = path . join (
@@ -20,7 +20,7 @@ let findExecutable = (uri: string) => {
2020return null ;
2121} else {
2222return {
23- binaryPathQuoted : '"' + binaryPath + '"' , // path could have white space
23+ binaryPath : binaryPath ,
2424filePathQuoted :'"' + filePath + '"' ,
2525cwd :projectRootPath ,
2626} ;
@@ -38,16 +38,18 @@ export function runDumpCommand(msg: RequestMessage): dumpCommandResult | null {
3838}
3939
4040let command =
41- executable . binaryPathQuoted +
42- " dump " +
4341executable . filePathQuoted +
4442":" +
4543msg . params . position . line +
4644":" +
4745msg . params . position . character ;
4846
4947try {
50- let stdout = execSync ( command , { cwd :executable . cwd } ) ;
48+ let stdout = execFileSync (
49+ executable . binaryPath ,
50+ [ "dump" , command ] ,
51+ { cwd :executable . cwd }
52+ ) ;
5153let parsed = JSON . parse ( stdout . toString ( ) ) ;
5254if ( parsed && parsed [ 0 ] ) {
5355return parsed [ 0 ] ;
@@ -73,8 +75,6 @@ export function runCompletionCommand(
7375fs . writeFileSync ( tmpname , code , { encoding :"utf-8" } ) ;
7476
7577let command =
76- executable . binaryPathQuoted +
77- " complete " +
7878executable . filePathQuoted +
7979":" +
8080msg . params . position . line +
@@ -84,7 +84,10 @@ export function runCompletionCommand(
8484tmpname ;
8585
8686try {
87- let stdout = execSync ( command , { cwd :executable . cwd } ) ;
87+ let stdout = execFileSync (
88+ executable . binaryPath ,
89+ [ "complete" , command ] ,
90+ { cwd :executable . cwd } ) ;
8891let parsed = JSON . parse ( stdout . toString ( ) ) ;
8992if ( parsed && parsed [ 0 ] ) {
9093return parsed ;