Fixes for the new shell mechanism on Windows

This commit is contained in:
blinry 2021-02-23 17:12:23 +01:00
parent 8803c26cfa
commit cebe42ba21
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.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)

View file

@ -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;