<snip>
> > > >> @@ -132,6 +135,9 @@ def send_command(self, command: str, prompt: str | 
> > > >> None = None) -> str:
> > > >>           self._stdin.flush()
> > > >>           out: str = ""
> > > >>           for line in self._stdout:
> > > >> +            if skip_first_line:
> > > >> +                skip_first_line = False
> > > >> +                continue
> > > >
> > > > Is there ever a reason to distinguish between the first line and the
> > > > line with the command on it?
> > >
> > > As above, not really sure. Would this always be a command prompt? The
>
> Whether this first line is always the command prompt or not is
> specific to the shell unfortunately. In "bash-like" shells where
> commands you send are echoed into stdout for easy-of-use for the
> developer (like testpmd), this first line will always be the command
> you sent to it. It technically isn't always required for this to
> happen however, so we could make this assumption, but it could be
> slightly more limiting down the line.

This is very insightful! This may be a bit naive on my end given that
I haven't provided much serious thought on this, but would it be
possible to include some kind of conditional statement that asserts
something like 'if the user-inputted prompt is in the first line and
it is proceeded by testpmd>, then remove the first line,' or something
along those lines?

I personally can't think of a reason that justifies leaving the
command prompt in the output. Although the weight of my input on this
is admittedly very light since I don't have a good intuition about
this issue.

<snip>

Reply via email to