Kill child process and close pty on exit

- Adds kill() method to LibuvUtils.
- Adds close() method to Pipe.
This commit is contained in:
Leroy Hopson 2021-07-22 12:17:23 +07:00
parent 55b0a0577d
commit c81da3820b
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
10 changed files with 53 additions and 9 deletions

View file

@ -1,5 +1,7 @@
extends "res://addons/gut/test.gd"
const LibuvUtils := preload("res://addons/godot_xterm/nodes/pty/libuv_utils.gd")
var pty: GDXterm.PTYUnix
var helper: Helper
@ -51,6 +53,16 @@ func test_open_pty_has_correct_win_size():
assert_eq(winsize.rows, rows)
func test_closes_pty_on_exit():
var num_pts = helper._get_pts().size()
pty.fork("sleep", ["1000"])
remove_child(pty)
pty.free()
yield(yield_for(1), YIELD)
var new_num_pts = helper._get_pts().size()
assert_eq(new_num_pts, num_pts)
class Helper:
static func _get_pts() -> Array:
assert(false, "Abstract method")