Skip to content

Commit

Permalink
fix: site builds not outputting in non-terminal environments
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Aug 15, 2024
1 parent 89e10c0 commit 460c7fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cmd/sst/mosaic/ui/footer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/charmbracelet/x/ansi"
"github.com/pulumi/pulumi/sdk/v3/go/common/apitype"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/sst/ion/cmd/sst/mosaic/ui/common"
"github.com/sst/ion/pkg/project"
"golang.org/x/crypto/ssh/terminal"
)
Expand Down Expand Up @@ -75,9 +74,9 @@ func (m *footer) Start(ctx context.Context) {
}
width, _, _ := terminal.GetSize(int(os.Stdout.Fd()))
switch evt := val.(type) {
case *common.StdoutEvent:
case lineMsg:
m.clear()
fmt.Println(evt.Line)
fmt.Println(evt)
default:
m.Update(val)
}
Expand Down Expand Up @@ -320,3 +319,5 @@ func (u *footer) formatURN(urn string) string {
}
return result
}

type lineMsg = string
5 changes: 4 additions & 1 deletion cmd/sst/mosaic/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (u *UI) println(args ...interface{}) {
fmt.Println(fmt.Sprint(u.buffer...))
}
if u.footer != nil {
u.footer.Send(&common.StdoutEvent{Line: fmt.Sprint(u.buffer...)})
u.footer.Send(lineMsg(fmt.Sprint(u.buffer...)))
}
u.buffer = []interface{}{}
u.hasBlank = false
Expand Down Expand Up @@ -133,6 +133,9 @@ func (u *UI) Event(unknown interface{}) {
}
switch evt := unknown.(type) {

case *common.StdoutEvent:
u.println(evt.Line)

case *aws.FunctionInvokedEvent:
u.workerTime[evt.WorkerID] = time.Now()
u.printEvent(u.getColor(evt.WorkerID), TEXT_NORMAL_BOLD.Render(fmt.Sprintf("%-11s", "Invoke")), u.functionName(evt.FunctionID))
Expand Down

0 comments on commit 460c7fa

Please sign in to comment.