mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-10 14:05:32 +02:00
Close terminal on successful exit
This commit is contained in:
parent
ec0d4ddf43
commit
7c6300c8dc
3 changed files with 18 additions and 0 deletions
|
@ -8,6 +8,7 @@ tool
|
|||
extends Control
|
||||
|
||||
const EditorTerminal := preload("./editor_terminal.tscn")
|
||||
const PTY := preload("../../nodes/pty/pty.gd")
|
||||
const TerminalSettings := preload("./settings/terminal_settings.gd")
|
||||
|
||||
const SETTINGS_FILE_PATH := "res://.gdxterm/settings.tres"
|
||||
|
@ -128,6 +129,7 @@ func _on_AddButton_pressed():
|
|||
terminal.editor_settings = editor_settings
|
||||
terminal.set_anchors_preset(PRESET_WIDE)
|
||||
terminal.connect("gui_input", self, "_on_TabContainer_gui_input")
|
||||
terminal.connect("exited", self, "_on_Terminal_exited", [terminal])
|
||||
tab_container.add_child(terminal)
|
||||
terminal.pty.fork(shell)
|
||||
terminal.grab_focus()
|
||||
|
@ -269,3 +271,10 @@ func _on_Panel_resized():
|
|||
func _on_SizeLabelTimer_timeout():
|
||||
if size_label:
|
||||
size_label.visible = false
|
||||
|
||||
|
||||
func _on_Terminal_exited(exit_code, signum, terminal):
|
||||
# Leave non-zero exit code terminals open in case they have some important
|
||||
# error information.
|
||||
if exit_code == 0:
|
||||
_on_Tabs_tab_close(terminal.get_index())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue