Skip to content

Commit

Permalink
Merge pull request #13 from vshaxe/fix_spawnSync
Browse files Browse the repository at this point in the history
Fix spawn sync
  • Loading branch information
AlexHaxe authored Aug 16, 2024
2 parents 8c7e572 + bf6d987 commit 887367d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .haxerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "4.2.5",
"version": "4.3.6",
"resolveLibs": "scoped"
}
4 changes: 2 additions & 2 deletions haxe_libraries/hxnodejs.hxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# @install: lix --silent download "haxelib:/hxnodejs#12.1.0" into hxnodejs/12.1.0/haxelib
-cp ${HAXE_LIBCACHE}/hxnodejs/12.1.0/haxelib/src
# @install: lix --silent download "haxelib:/hxnodejs#12.2.0" into hxnodejs/12.2.0/haxelib
-cp ${HAXE_LIBCACHE}/hxnodejs/12.2.0/haxelib/src
-D hxnodejs=12.1.0
--macro allowPackage('sys')
# should behave like other target defines and not be defined in macro context
Expand Down
11 changes: 8 additions & 3 deletions src/Main.hx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Protocol;
import haxe.DynamicAccess;
import js.node.Buffer;
import js.node.ChildProcess;
import js.node.Net;
import js.node.child_process.ChildProcess.ChildProcessEvent;
import js.node.net.Socket.SocketEvent;
import js.node.stream.Readable.ReadableEvent;
import Protocol;
import vscode.debugProtocol.DebugProtocol;

using Lambda;
Expand Down Expand Up @@ -83,7 +83,7 @@ class Main extends vscode.debugAdapter.DebugSession {
return false;
}

final versionCheck = ChildProcess.spawnSync(haxe, ["-version"], {env: env, cwd: cwd});
final versionCheck = ChildProcess.spawnSync(haxe, ["-version"], {env: env, cwd: cwd, shell: true});
var output = (versionCheck.stderr : Buffer).toString().trim();
if (output == "")
output = (versionCheck.stdout : Buffer).toString().trim(); // haxe 4.0 prints -version output to stdout instead
Expand Down Expand Up @@ -140,7 +140,12 @@ class Main extends vscode.debugAdapter.DebugSession {
server.listen(0, function() {
final port = server.address().port;
final haxeArgs = ["--cwd", cwd, "-D", 'eval-debugger=127.0.0.1:$port'].concat(haxeArgs);
final haxeProcess = ChildProcess.spawn(haxe, haxeArgs, {stdio: Pipe, env: env, cwd: cwd});
final haxeProcess = ChildProcess.spawn(haxe, haxeArgs, {
stdio: Pipe,
env: env,
cwd: cwd,
shell: true
});
haxeProcess.stdout.on(ReadableEvent.Data, onStdout);
haxeProcess.stderr.on(ReadableEvent.Data, onStderr);
haxeProcess.on(ChildProcessEvent.Exit, (_, _) -> exit());
Expand Down

0 comments on commit 887367d

Please sign in to comment.