···436436 </para>
437437 </listitem>
438438 </varlistentry>
439439+ <varlistentry>
440440+ <term>
441441+ <methodname>shell_interact</methodname>
442442+ </term>
443443+ <listitem>
444444+ <para>
445445+ Allows you to directly interact with the guest shell.
446446+ This should only be used during test development, not in production tests.
447447+ Killing the interactive session with <literal>Ctrl-d</literal> or <literal>Ctrl-c</literal> also ends the guest session.
448448+ </para>
449449+ </listitem>
450450+ </varlistentry>
439451 </variablelist>
440452 </para>
441453
+11
nixos/lib/test-driver/test-driver.py
···2121import socket
2222import subprocess
2323import sys
2424+import telnetlib
2425import tempfile
2526import time
2627import traceback
···454455 status_code = int(match[2])
455456 return (status_code, output)
456457 output += chunk
458458+459459+ def shell_interact(self) -> None:
460460+ """Allows you to interact with the guest shell
461461+462462+ Should only be used during test development, not in the production test."""
463463+ self.connect()
464464+ self.log("Terminal is ready (there is no prompt):")
465465+ telnet = telnetlib.Telnet()
466466+ telnet.sock = self.shell # type: ignore
467467+ telnet.interact()
457468458469 def succeed(self, *commands: str) -> str:
459470 """Execute each command and check that it succeeds."""