From 1b7bb246d15e755c7354cc830e12eff184f85beb Mon Sep 17 00:00:00 2001 From: blinry Date: Tue, 23 Feb 2021 17:12:23 +0100 Subject: [PATCH] Fixes for the new shell mechanism on Windows --- scenes/game.gd | 8 +++++++- scripts/net-test | 17 ++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/scenes/game.gd b/scenes/game.gd index 976bb60..4aa2a87 100644 --- a/scenes/game.gd +++ b/scenes/game.gd @@ -44,7 +44,7 @@ func start_remote_shell(): target_file.open(target_filename, File.WRITE) target_file.store_string(script_content) target_file.close() - helpers.exec_async(_perl_executable(), [target_filename]) + helpers.exec_async(_perl_executable(), [target_filename, _bash_executable()]) func _perl_executable(): if OS.get_name() == "Windows": @@ -52,6 +52,12 @@ func _perl_executable(): else: return "perl" +func _bash_executable(): + if OS.get_name() == "Windows": + return "dependencies/windows/git/usr/bin/bash.exe" + else: + return "bash" + func shell_received(text): print(text) diff --git a/scripts/net-test b/scripts/net-test index dc70d8d..9d36790 100755 --- a/scripts/net-test +++ b/scripts/net-test @@ -1,20 +1,21 @@ #!/usr/bin/env perl -use IPC::Open2; +use IPC::Open3; use IO::Socket; -my $pid = open2(my $out, my $in, 'bash'); +my $bash = "bash"; +if ($#ARGV >= 0) { + $bash = $ARGV[0]; +} + +my $pid = open3(my $in, my $out, my $err, $bash); $socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1", PeerPort => 6666, Proto => "tcp", Type => SOCK_STREAM); -#$s = "Hey äöü!"; -# -#my $send_length = pack("L", length($s)); -#$socket->send($send_length); -#$socket->send($s); +print $in 'export PATH="/usr/bin:/mingw64/bin:$PATH"' . "\n"; while(true) { #STDOUT->flush(); @@ -32,8 +33,6 @@ while(true) { print($s2); STDOUT->flush(); - #$s = `bash -c '$s2' 2>&1`; - $s = ""; $command = $s2 . "\necho MAGIC\n"; print $in $command;