diff --git a/internal/logger/logger.go b/internal/logger/logger.go index 02008cef..f4c9b569 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -743,6 +743,7 @@ func PrintSummary(useColor UseColor, table SummaryTable, start *time.Time) { sb.WriteString(fmt.Sprintf("%s%s...and %d more output file%s...%s\n", margin, colors.Dim, length-maxLength, plural, colors.Default)) } } + sb.WriteByte('\n') lightningSymbol := "⚡ " @@ -753,7 +754,7 @@ func PrintSummary(useColor UseColor, table SummaryTable, start *time.Time) { // Printing the time taken is optional if start != nil { - sb.WriteString(fmt.Sprintf("\n%s%sDone in %dms%s\n", + sb.WriteString(fmt.Sprintf("%s%sDone in %dms%s\n", lightningSymbol, colors.Green, time.Since(*start).Milliseconds(), @@ -761,7 +762,6 @@ func PrintSummary(useColor UseColor, table SummaryTable, start *time.Time) { )) } - sb.WriteByte('\n') return sb.String() }) } diff --git a/pkg/api/api_impl.go b/pkg/api/api_impl.go index c85ec3a8..799f9aa4 100644 --- a/pkg/api/api_impl.go +++ b/pkg/api/api_impl.go @@ -625,8 +625,10 @@ func buildImpl(buildOpts BuildOptions) internalBuildResult { plugins := loadPlugins(realFS, log, buildOpts.Plugins) internalResult := rebuildImpl(buildOpts, cache.MakeCacheSet(), plugins, logOptions, log, false /* isRebuild */) - // Print a summary to stderr - if logOptions.LogLevel <= logger.LevelInfo && buildOpts.Watch == nil && !buildOpts.Incremental { + // Print a summary of the generated files to stderr. Except don't do + // this if the terminal is already being used for something else. + if logOptions.LogLevel <= logger.LevelInfo && len(internalResult.result.OutputFiles) > 0 && + buildOpts.Watch == nil && !buildOpts.Incremental && !internalResult.options.WriteToStdout { printSummary(logOptions, internalResult.result.OutputFiles, start) }