CompileDaemon icon indicating copy to clipboard operation
CompileDaemon copied to clipboard

Flush logging buffer before printing CompileDaemon output

Open evanpurkhiser opened this issue 9 years ago • 2 comments

Since the logger buffer isn't flushed until another newline is found it's possible that the output that CompileDaemon generates can be affected by ANSII escape sequences that haven't been terminated due to no newline being printed.

For example, a program that writes output with color, writes a newline, then immediately writes the color reset escape sequence. Because the output is buffered the reset escape sequence won't be written until a newline is outputted. However, if the program is terminated and restarted it will never write the reset escape sequence and the output from CompileDaemon (eg "Running build command!") will be affected by the previous escape sequence.

Obviously this could be fixed by outputting the reset sequence before writing a newline, but it seems like the 'correct' solution would be for this software to flush the buffer when a program is recompiled.

evanpurkhiser avatar Mar 10 '16 04:03 evanpurkhiser

package main
import "fmt"

func main() {
    fmt.Println(string(27) + "[31mColored.");
    fmt.Print(string(27) + "[0m");
}

Is this your test case?

githubnemo avatar Mar 11 '16 14:03 githubnemo

Correct.

image

evanpurkhiser avatar Mar 11 '16 21:03 evanpurkhiser