Skip to content

Commit fb071a2

Browse files
committed
always show stderr/stdout output from program
1 parent d54fd16 commit fb071a2

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

tsunami/build/build.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,10 @@ func TsunamiRun(opts BuildOpts) error {
748748
return nil
749749
}
750750

751-
func monitorAndOpenBrowser(stdout io.ReadCloser, verbose bool) {
752-
defer stdout.Close()
751+
func monitorAndOpenBrowser(r io.ReadCloser, verbose bool) {
752+
defer r.Close()
753753

754-
scanner := bufio.NewScanner(stdout)
754+
scanner := bufio.NewScanner(r)
755755
urlRegex := regexp.MustCompile(`\[tsunami\] listening at (http://[^\s]+)`)
756756
browserOpened := false
757757
if verbose {
@@ -760,9 +760,7 @@ func monitorAndOpenBrowser(stdout io.ReadCloser, verbose bool) {
760760

761761
for scanner.Scan() {
762762
line := scanner.Text()
763-
if verbose {
764-
fmt.Println(line)
765-
}
763+
fmt.Println(line)
766764

767765
if !browserOpened && len(urlRegex.FindStringSubmatch(line)) > 1 {
768766
matches := urlRegex.FindStringSubmatch(line)
@@ -774,11 +772,4 @@ func monitorAndOpenBrowser(stdout io.ReadCloser, verbose bool) {
774772
browserOpened = true
775773
}
776774
}
777-
778-
// Continue reading and printing output if verbose
779-
if verbose {
780-
for scanner.Scan() {
781-
fmt.Println(scanner.Text())
782-
}
783-
}
784775
}

0 commit comments

Comments
 (0)