Fixes for the new shell mechanism on Windows

This commit is contained in:
blinry 2021-02-23 17:12:23 +01:00
parent 53c249d059
commit 1b7bb246d1
2 changed files with 15 additions and 10 deletions

View file

@ -44,7 +44,7 @@ func start_remote_shell():
target_file.open(target_filename, File.WRITE) target_file.open(target_filename, File.WRITE)
target_file.store_string(script_content) target_file.store_string(script_content)
target_file.close() target_file.close()
helpers.exec_async(_perl_executable(), [target_filename]) helpers.exec_async(_perl_executable(), [target_filename, _bash_executable()])
func _perl_executable(): func _perl_executable():
if OS.get_name() == "Windows": if OS.get_name() == "Windows":
@ -52,6 +52,12 @@ func _perl_executable():
else: else:
return "perl" 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): func shell_received(text):
print(text) print(text)

View file

@ -1,20 +1,21 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use IPC::Open2; use IPC::Open3;
use IO::Socket; 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", $socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
PeerPort => 6666, PeerPort => 6666,
Proto => "tcp", Proto => "tcp",
Type => SOCK_STREAM); Type => SOCK_STREAM);
#$s = "Hey äöü!"; print $in 'export PATH="/usr/bin:/mingw64/bin:$PATH"' . "\n";
#
#my $send_length = pack("L", length($s));
#$socket->send($send_length);
#$socket->send($s);
while(true) { while(true) {
#STDOUT->flush(); #STDOUT->flush();
@ -32,8 +33,6 @@ while(true) {
print($s2); print($s2);
STDOUT->flush(); STDOUT->flush();
#$s = `bash -c '$s2' 2>&1`;
$s = ""; $s = "";
$command = $s2 . "\necho MAGIC\n"; $command = $s2 . "\necho MAGIC\n";
print $in $command; print $in $command;