Skip to content

Commit

Permalink
synchronize terminal test on prompt, avoid panic (#7717)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Suraci <alex@dagger.io>
  • Loading branch information
vito committed Jun 21, 2024
1 parent 3828ad6 commit 4788020
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions core/integration/module_terminal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ type Test struct {
err = cmd.Start()
require.NoError(t, err)

_, err = console.ExpectString(" $ ")
require.NoError(t, err)

_, err = console.SendLine("pwd")
require.NoError(t, err)

Expand Down
10 changes: 7 additions & 3 deletions dagql/idtui/frontend_pretty.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ func New() Frontend {
profile := ColorProfile()
view := new(strings.Builder)
return &frontendPretty{
db: db,
logs: newPrettyLogs(),

db: db,
logs: newPrettyLogs(),
autoFocus: true,

// set empty initial row state to avoid nil checks
rowsView: &RowsView{},
rows: &Rows{BySpan: map[trace.SpanID]*TraceRow{}},

// initial TUI state
window: tea.WindowSizeMsg{Width: -1, Height: -1}, // be clear that it's not set
fps: 30, // sane default, fine-tune if needed
profile: profile,
Expand Down

0 comments on commit 4788020

Please sign in to comment.