nixos/test-driver: Crash on closed socket during connect()
If a VM crashes during `connect()`, e.g. because of `panic_on_fail` during initrd, we would spin on the closed socket forever. We should rasie an exception instead.
This commit is contained in:
@@ -819,9 +819,8 @@ class Machine:
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
chunk = self.shell.recv(1024)
|
chunk = self.shell.recv(1024)
|
||||||
# No need to print empty strings, it means we are waiting.
|
|
||||||
if len(chunk) == 0:
|
if len(chunk) == 0:
|
||||||
continue
|
raise RuntimeError("Shell disconnected")
|
||||||
self.log(f"Guest shell says: {chunk!r}")
|
self.log(f"Guest shell says: {chunk!r}")
|
||||||
# NOTE: for this to work, nothing must be printed after this line!
|
# NOTE: for this to work, nothing must be printed after this line!
|
||||||
if b"Spawning backdoor root shell..." in chunk:
|
if b"Spawning backdoor root shell..." in chunk:
|
||||||
|
|||||||
Reference in New Issue
Block a user