mirror of
https://github.com/clearml/wexpect-venv
synced 2025-01-31 02:46:59 +00:00
[ADD] terminal local echo feature
This commit is contained in:
parent
9998875dd9
commit
3965fd4f65
@ -85,7 +85,7 @@ class ConsoleReaderBase:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, path, host_pid, cp=None, window_size_x=80, window_size_y=25,
|
def __init__(self, path, host_pid, cp=None, window_size_x=80, window_size_y=25,
|
||||||
buffer_size_x=80, buffer_size_y=16000, **kwargs):
|
buffer_size_x=80, buffer_size_y=16000, local_echo=True, **kwargs):
|
||||||
"""Initialize the console starts the child in it and reads the console periodically.
|
"""Initialize the console starts the child in it and reads the console periodically.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -103,7 +103,7 @@ class ConsoleReaderBase:
|
|||||||
self.connection = None
|
self.connection = None
|
||||||
self.consin = None
|
self.consin = None
|
||||||
self.consout = None
|
self.consout = None
|
||||||
self.local_echo = True
|
self.local_echo = local_echo
|
||||||
self.console_pid = os.getpid()
|
self.console_pid = os.getpid()
|
||||||
self.host_pid = host_pid
|
self.host_pid = host_pid
|
||||||
self.host_process = psutil.Process(host_pid)
|
self.host_process = psutil.Process(host_pid)
|
||||||
|
@ -242,6 +242,7 @@ class SpawnBase:
|
|||||||
self.delimiter = EOF
|
self.delimiter = EOF
|
||||||
self.cwd = cwd
|
self.cwd = cwd
|
||||||
self.env = env
|
self.env = env
|
||||||
|
self.echo = echo
|
||||||
self.maxread = maxread # max bytes to read at one time into buffer
|
self.maxread = maxread # max bytes to read at one time into buffer
|
||||||
self.delaybeforesend = 0.05 # Sets sleep time used just before sending data to child. Time in seconds.
|
self.delaybeforesend = 0.05 # Sets sleep time used just before sending data to child. Time in seconds.
|
||||||
self.delayafterterminate = 0.1 # Sets delay in terminate() method to allow kernel time to update process status. Time in seconds.
|
self.delayafterterminate = 0.1 # Sets delay in terminate() method to allow kernel time to update process status. Time in seconds.
|
||||||
@ -913,7 +914,7 @@ class SpawnPipe(SpawnBase):
|
|||||||
"import wexpect;"
|
"import wexpect;"
|
||||||
"import time;"
|
"import time;"
|
||||||
"wexpect.console_reader.logger.info('loggerStart.');"
|
"wexpect.console_reader.logger.info('loggerStart.');"
|
||||||
f"wexpect.ConsoleReaderPipe(wexpect.join_args({args}), {pid});"
|
f"wexpect.ConsoleReaderPipe(wexpect.join_args({args}), {pid}, local_echo={self.echo});"
|
||||||
"wexpect.console_reader.logger.info('Console finished2.');"
|
"wexpect.console_reader.logger.info('Console finished2.');"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1030,7 +1031,7 @@ class SpawnSocket(SpawnBase):
|
|||||||
"import wexpect;"
|
"import wexpect;"
|
||||||
"import time;"
|
"import time;"
|
||||||
"wexpect.console_reader.logger.info('loggerStart.');"
|
"wexpect.console_reader.logger.info('loggerStart.');"
|
||||||
f"wexpect.ConsoleReaderSocket(wexpect.join_args({args}), {pid}, port={self.port});"
|
f"wexpect.ConsoleReaderSocket(wexpect.join_args({args}), {pid}, port={self.port}, local_echo={self.echo});"
|
||||||
"wexpect.console_reader.logger.info('Console finished2.');"
|
"wexpect.console_reader.logger.info('Console finished2.');"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user