diff --git a/cmd/esbuild/main.go b/cmd/esbuild/main.go index 94671d6d5d3..8b0279e1170 100644 --- a/cmd/esbuild/main.go +++ b/cmd/esbuild/main.go @@ -331,12 +331,16 @@ func main() { for { _, err := os.Stdin.Read(buffer) if err != nil { - // Mention why watch mode was stopped to reduce confusion, and - // call out "--watch=forever" to get the alternative behavior - if isWatch { - if options := logger.OutputOptionsForArgs(osArgs); options.LogLevel <= logger.LevelInfo { + if options := logger.OutputOptionsForArgs(osArgs); options.LogLevel <= logger.LevelInfo { + if isWatch { + // Mention why watch mode was stopped to reduce confusion, and + // call out "--watch=forever" to get the alternative behavior logger.PrintTextWithColor(os.Stderr, options.Color, func(colors logger.Colors) string { - return fmt.Sprintf("%s[watch] stopped because stdin was closed (use \"--watch=forever\" to keep watching even after stdin is closed)%s\n", colors.Dim, colors.Reset) + return fmt.Sprintf("%s[watch] stopped automatically because stdin was closed (use \"--watch=forever\" to keep watching even after stdin is closed)%s\n", colors.Dim, colors.Reset) + }) + } else if isServeOrWatch { + logger.PrintTextWithColor(os.Stderr, options.Color, func(colors logger.Colors) string { + return fmt.Sprintf("%s[serve] stopped automatically because stdin was closed (keep stdin open to continue serving)%s\n", colors.Dim, colors.Reset) }) } }