vmcli/test: run shell after providing input

In some cases, `Run()` can read from input before we have written
anything to it.
This commit is contained in:
Evgenii Stratonikov 2020-12-10 13:35:50 +03:00
parent d828096cbf
commit 76a6ddc3a4

View file

@ -75,16 +75,16 @@ func newTestVMCLIWithLogo(t *testing.T, printLogo bool) *executor {
Stdin: e.in,
Stdout: e.out,
})
go func() {
require.NoError(t, e.cli.Run())
close(e.ch)
}()
return e
}
func (e *executor) runProg(t *testing.T, commands ...string) {
cmd := strings.Join(commands, "\n") + "\n"
e.in.WriteString(cmd + "\n")
go func() {
require.NoError(t, e.cli.Run())
close(e.ch)
}()
select {
case <-e.ch:
case <-time.After(time.Second):