mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
Directly run the command in the shell
This commit is contained in:
parent
b13e9baf4e
commit
3896a0492a
4 changed files with 17 additions and 19 deletions
|
@ -141,8 +141,12 @@ func toggle_music():
|
|||
|
||||
func shell_test(command):
|
||||
mutex.lock()
|
||||
print("go")
|
||||
#print("go")
|
||||
print(command)
|
||||
var before = OS.get_ticks_msec()
|
||||
var response = $ShellServer.send(command)
|
||||
print("stop")
|
||||
var after = OS.get_ticks_msec()
|
||||
print("took " + str(after-before)+" ms")
|
||||
#print("stop")
|
||||
mutex.unlock()
|
||||
return response
|
||||
|
|
|
@ -53,11 +53,11 @@ func run_async_thread(shell_command):
|
|||
for variable in env:
|
||||
hacky_command += "export %s='%s';" % [variable, env[variable]]
|
||||
|
||||
hacky_command += "export PATH=\'"+game.tmp_prefix+":'\"$PATH\";"
|
||||
#hacky_command += "export PATH=\'"+game.tmp_prefix+":'\"$PATH\";"
|
||||
hacky_command += "cd '%s' || exit 1;" % _cwd
|
||||
hacky_command += command
|
||||
|
||||
print(hacky_command)
|
||||
#print(hacky_command)
|
||||
|
||||
var result
|
||||
var shell_command_internal = game.shell_test(hacky_command)
|
||||
|
|
|
@ -44,8 +44,8 @@ func send(text):
|
|||
var shell_command = ShellCommand.new()
|
||||
shell_command.command = text
|
||||
shell_command.output = response
|
||||
print("response:")
|
||||
print(response)
|
||||
#print("response:")
|
||||
#print(response)
|
||||
shell_command.exit_code = exit_code
|
||||
return shell_command
|
||||
else:
|
||||
|
|
|
@ -23,24 +23,18 @@ while(true) {
|
|||
$socket->recv($len, 4);
|
||||
my $actual_len = unpack("L", $len);
|
||||
if ($actual_len == 0) {
|
||||
print("not connected");
|
||||
#print("not connected");
|
||||
exit;
|
||||
}
|
||||
print("still connected");
|
||||
#print("still connected");
|
||||
my $s2;
|
||||
$socket->recv($s2, $actual_len);
|
||||
|
||||
print($s2);
|
||||
#print($s2);
|
||||
STDOUT->flush();
|
||||
|
||||
my $script;
|
||||
open($script, ">", "/tmp/omgscript") or die $!;
|
||||
#$s3 = 'export HOME=\'/home/blinry/.local/share/Oh My Git/tmp/\';export PATH=\'/home/blinry/.local/share/Oh My Git/tmp/:\'"$PATH";cd \'/home/blinry/.local/share/Oh My Git/tmp/repos/yours/\' || exit 1;find . -type f -not -path \'*/\\.git/*\'';
|
||||
print $script $s2;
|
||||
close($script);
|
||||
|
||||
$s = "";
|
||||
$command = ". /tmp/omgscript" . "\necho MAGIC\n";
|
||||
$command = $s2 . "\necho MAGIC\n";
|
||||
print $in $command;
|
||||
|
||||
inner_while: while (true) {
|
||||
|
@ -51,10 +45,10 @@ while(true) {
|
|||
}
|
||||
$s = $s . $line;
|
||||
}
|
||||
print "got complete output";
|
||||
print $s;
|
||||
#print "got complete output";
|
||||
#print $s;
|
||||
|
||||
print length($s);
|
||||
#print length($s);
|
||||
STDOUT->flush();
|
||||
my $send_length = pack("L", length($s));
|
||||
$socket->send($send_length);
|
||||
|
|
Loading…
Reference in a new issue