Skip to content

Commit d611d46

Browse files
liambradychoppsv1
authored andcommitted
munet: fix desync after send/expect
spawn() within shell_spawn() already provides a newline when no shell/login prompt is found. Sending a second newline after the expected prompt is detected results in a desync in the console I/O. This is because the response received from sending the newline is not consumed. Thus, any future instance after the desync of cmd_nostatus() or cmd_status() after shell_spawn() finishes either throws a warning or fails. The instability due to the desync can break following features that rely on such functionality, such as the mounting of shared volumes into the QEMU VM. Signed-off-by: Liam Brady <lbrady@labn.net>
1 parent c7da29d commit d611d46

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

munet/base.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,6 @@ async def shell_spawn(
886886
use_pty=False,
887887
will_echo=False,
888888
is_bourne=True,
889-
init_newline=False,
890889
**kwargs,
891890
):
892891
"""Create a shell REPL (read-eval-print-loop).
@@ -901,8 +900,6 @@ async def shell_spawn(
901900
be the empty string to send nothing.
902901
is_bourne: if False then do not modify shell prompt for internal
903902
parser friently format, and do not expect continuation prompts.
904-
init_newline: send an initial newline for non-bourne shell spawns, otherwise
905-
expect the prompt simply from running the command
906903
use_pty: true for pty based expect, otherwise uses popen (pipes/files)
907904
will_echo: bash is buggy in that it echo's to non-tty unlike any other
908905
sh/ksh, set this value to true if running back
@@ -923,8 +920,6 @@ async def shell_spawn(
923920
assert not p.echo
924921

925922
if not is_bourne:
926-
if init_newline:
927-
p.send("\n")
928923
return ShellWrapper(p, prompt, will_echo=will_echo)
929924

930925
ps1 = PEXPECT_PROMPT

munet/native.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2290,7 +2290,6 @@ async def _opencons(
22902290
expects=expects,
22912291
sends=sends,
22922292
timeout=timeout,
2293-
init_newline=True,
22942293
trace=True,
22952294
)
22962295
)

0 commit comments

Comments
 (0)