Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit06518b6

Browse files
committed
execSync -> execFileSync for RescriptEditorSupport binary invocation
Part of#81
1 parent04fa844 commit06518b6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

‎server/src/RescriptEditorSupport.ts‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { fileURLToPath } from "url";
22
import{RequestMessage}from"vscode-languageserver";
33
import*asutilsfrom"./utils";
44
import*aspathfrom"path";
5-
import{execSync}from"child_process";
5+
import{execFileSync}from"child_process";
66
importfsfrom"fs";
77

88
letbinaryPath=path.join(
@@ -20,7 +20,7 @@ let findExecutable = (uri: string) => {
2020
returnnull;
2121
}else{
2222
return{
23-
binaryPathQuoted:'"'+binaryPath+'"',// path could have white space
23+
binaryPath:binaryPath,
2424
filePathQuoted:'"'+filePath+'"',
2525
cwd:projectRootPath,
2626
};
@@ -38,16 +38,18 @@ export function runDumpCommand(msg: RequestMessage): dumpCommandResult | null {
3838
}
3939

4040
letcommand=
41-
executable.binaryPathQuoted+
42-
" dump "+
4341
executable.filePathQuoted+
4442
":"+
4543
msg.params.position.line+
4644
":"+
4745
msg.params.position.character;
4846

4947
try{
50-
letstdout=execSync(command,{cwd:executable.cwd});
48+
letstdout=execFileSync(
49+
executable.binaryPath,
50+
["dump",command],
51+
{cwd:executable.cwd}
52+
);
5153
letparsed=JSON.parse(stdout.toString());
5254
if(parsed&&parsed[0]){
5355
returnparsed[0];
@@ -73,8 +75,6 @@ export function runCompletionCommand(
7375
fs.writeFileSync(tmpname,code,{encoding:"utf-8"});
7476

7577
letcommand=
76-
executable.binaryPathQuoted+
77-
" complete "+
7878
executable.filePathQuoted+
7979
":"+
8080
msg.params.position.line+
@@ -84,7 +84,10 @@ export function runCompletionCommand(
8484
tmpname;
8585

8686
try{
87-
letstdout=execSync(command,{cwd:executable.cwd});
87+
letstdout=execFileSync(
88+
executable.binaryPath,
89+
["complete",command],
90+
{cwd:executable.cwd});
8891
letparsed=JSON.parse(stdout.toString());
8992
if(parsed&&parsed[0]){
9093
returnparsed;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp