summaryrefslogtreecommitdiffstats
path: root/nixos/lib/test-driver
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2021-06-22 08:51:39 +0200
committerJörg Thalheim <joerg@thalheim.io>2021-06-22 09:08:57 +0200
commit48aec70ea13aaf16d0f58e7525823cc3820cdc40 (patch)
treed2ef31b0b552c71b145c579d18c37af7181d3503 /nixos/lib/test-driver
parenta95eebd1cd1e06b7862ac1a99d9054eab94b97f7 (diff)
nixos/test-driver: replace termlib with socat
telnetlib does not handle unicode, which is annoying when using systemctl. Also this gives us a nice readline with history.
Diffstat (limited to 'nixos/lib/test-driver')
-rw-r--r--nixos/lib/test-driver/test-driver.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index 5be741395a08..7f4dd5963c92 100644
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -462,9 +462,10 @@ class Machine:
Should only be used during test development, not in the production test."""
self.connect()
self.log("Terminal is ready (there is no prompt):")
- telnet = telnetlib.Telnet()
- telnet.sock = self.shell # type: ignore
- telnet.interact()
+ subprocess.run(
+ ["socat", "READLINE", f"FD:{self.shell.fileno()}"],
+ pass_fds=[self.shell.fileno()],
+ )
def succeed(self, *commands: str) -> str:
"""Execute each command and check that it succeeds."""