...
This commit is contained in:
parent
4cbae1db89
commit
e881850bb4
@ -255,10 +255,12 @@ class PTY:
|
||||
del self.slave_fd
|
||||
del self.master_fd
|
||||
|
||||
def write_to_child(self, data):
|
||||
def write_to_child(self, data, flush=False):
|
||||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
self.write_buf += data
|
||||
if flush:
|
||||
self.process_input_from_child(0)
|
||||
|
||||
def send_cmd_to_child(self, cmd):
|
||||
self.write_to_child(cmd + '\r')
|
||||
|
||||
@ -93,7 +93,7 @@ def socket_child_main(exit_code=0, initial_print=''):
|
||||
pty.wait_till(lambda: 'child ready:' in pty.screen_contents())
|
||||
pty.set_window_size(columns=cols + 3)
|
||||
pty.wait_till(lambda: f'Screen size changed: {cols + 3}' in pty.screen_contents())
|
||||
pty.write_to_child('\x03' * 64)
|
||||
pty.write_to_child('\x03' * 64, flush=True)
|
||||
wait_for_death(signal.SIGINT, timeout=30)
|
||||
pty.wait_till(lambda: 'KeyboardInterrupt' in pty.screen_contents(), timeout=30)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user