Skip to content

Commit

Permalink
Fix spawn sync (#130)
Browse files Browse the repository at this point in the history
* added shell=true parameter to spawnSync calls
* fixed watched file events from appending log entries when not enabled, fixes vshaxe/vshaxe#636
  • Loading branch information
AlexHaxe committed Aug 16, 2024
1 parent 90dc446 commit 9c3114d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/haxeLanguageServer/features/haxe/DiagnosticsFeature.hx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DiagnosticsFeature {
}
timerName = useJsonRpc ? DisplayMethods.Diagnostics : "@diagnostics";

ChildProcess.exec(context.config.haxelib.executable + " config", (error, stdout, stderr) -> haxelibPath = new FsPath(stdout.trim()));
ChildProcess.exec(context.config.haxelib.executable + " config", {shell: true}, (error, stdout, stderr) -> haxelibPath = new FsPath(stdout.trim()));

context.languageServerProtocol.onNotification(LanguageServerMethods.RunGlobalDiagnostics, onRunGlobalDiagnostics);
}
Expand Down
2 changes: 1 addition & 1 deletion src/haxeLanguageServer/server/HaxeServer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class HaxeServer {
mergeEnvs(js.Node.process.env, env);
mergeEnvs(config.env, env);

final spawnOptions = {env: env, cwd: context.workspacePath.toString()};
final spawnOptions = {env: env, cwd: context.workspacePath.toString(), shell: true};

if (!checkHaxeVersion(config.path, spawnOptions)) {
return;
Expand Down
11 changes: 7 additions & 4 deletions src/haxeLanguageServer/server/ServerRecording.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package haxeLanguageServer.server;

import haxe.Json;
import haxe.io.Path;
import haxeLanguageServer.Configuration.ServerRecordingConfig;
import haxeLanguageServer.helper.FsHelper;
import haxeLanguageServer.server.ServerRecordingTools.getVcsState;
import jsonrpc.CancellationToken;
import jsonrpc.ResponseError;
import sys.FileSystem;
import sys.io.File;
import sys.io.FileOutput;
import sys.FileSystem;
import haxeLanguageServer.Configuration.ServerRecordingConfig;
import haxeLanguageServer.helper.FsHelper;
import haxeLanguageServer.server.ServerRecordingTools.getVcsState;

using StringTools;
using haxeLanguageServer.helper.StringHelper;
Expand Down Expand Up @@ -170,6 +170,9 @@ class ServerRecording {
}

public function onFileEvent(event:FileEvent):Void {
if (!enabled)
return;

final kind = switch (event.type) {
case Changed: "fileChanged";
case Created: "fileCreated";
Expand Down

0 comments on commit 9c3114d

Please sign in to comment.