From acf0c937e7d12a3e389b722a246a7d95e511c523 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 6 May 2017 16:05:33 +0200 Subject: fix prompt() The prompt() is useful for supervisor (user) interaction during tests. However it had numerous problems: - closed stdin, so second prompt() didn't work - no editing - no utf-8 multichar - unflexible poll interval (poll often to stay responsive to input) and unrelated: - stdin was hijacked by subprocess.Popen Firstly pass stdin=PIPE to all subprocesses to leave the tester's stdin untouched. Secondly use python input() to read the user entry (instead of mucking about with the stdin fd), and import readline for history and editing features. The old approach was put in place to allow polling DBus and processes regularly. Instead, allow this by running input() in a separate thread while polling regularly and slowly in the main thread. The prompt code is now simpler, cleaner and works better. Will be used in the upcoming 'debug' suite. Change-Id: I580aca52cd038b59418055259d0d09e9aab49124 --- src/osmo_gsm_tester/process.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/osmo_gsm_tester/process.py') diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py index 16f7905..a687de6 100644 --- a/src/osmo_gsm_tester/process.py +++ b/src/osmo_gsm_tester/process.py @@ -73,6 +73,7 @@ class Process(log.Origin): self.popen_args, stdout=self.make_output_log('stdout'), stderr=self.make_output_log('stderr'), + stdin=subprocess.PIPE, shell=False, cwd=self.run_dir.path, **self.popen_kwargs) -- cgit v1.2.3