mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-29 20:29:00 +02:00
Start working on a better shell mechanism for Windows
It uses a Perl script to keep a bash session open, which attaches to a port the game keeps open. This avoids having to start a new Git bash for each command, improving the execution speed by a factor of 3-4.
This commit is contained in:
parent
2a82b617be
commit
53c249d059
8 changed files with 145 additions and 15 deletions
scenes
|
@ -1,6 +1,7 @@
|
|||
extends Node
|
||||
|
||||
signal data_received(string)
|
||||
signal new_connection
|
||||
|
||||
export var port: int
|
||||
|
||||
|
@ -21,21 +22,24 @@ func _process(_delta):
|
|||
helpers.crash("Dropping active connection")
|
||||
_c = _s.take_connection()
|
||||
_connected = true
|
||||
emit_signal("new_connection")
|
||||
print("connected!")
|
||||
|
||||
if _connected:
|
||||
if _c.get_status() != StreamPeerTCP.STATUS_CONNECTED:
|
||||
_connected = false
|
||||
print("disconnected")
|
||||
var available = _c.get_available_bytes()
|
||||
while available > 0:
|
||||
var data = _c.get_utf8_string(available)
|
||||
emit_signal("data_received", data)
|
||||
available = _c.get_available_bytes()
|
||||
# var available = _c.get_available_bytes()
|
||||
# while available > 0:
|
||||
# var data = _c.get_utf8_string(available)
|
||||
# emit_signal("data_received", data)
|
||||
# available = _c.get_available_bytes()
|
||||
|
||||
func send(text):
|
||||
if _connected:
|
||||
text += "\n"
|
||||
_c.put_data(text.to_utf8())
|
||||
_c.put_utf8_string(text)
|
||||
var response = _c.get_utf8_string()
|
||||
emit_signal("data_received", response)
|
||||
else:
|
||||
helpers.crash("Trying to send data on closed connection")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue