bneijt / ccbuild

C++ source scanning build utility
GNU General Public License v2.0
5 stars 3 forks source link

Race condition on colouring output if cerrror and cout are on the same terminal #10

Closed bneijt closed 14 years ago

bneijt commented 15 years ago

ccbuild locks on cerr and on cout independently to make sure that the output of multiple commands do not cross on the terminal. However, this fails if the terminal decides to interweave cerr and cout and does not keep colouring scheme separate.

The gnome-terminal is an example of this: placing VT100 colouring codes on the cerr will also influence the colour on cout, which causes a race condition that can create coloured output while it should not be.

Invocations of ccbuild --verbose -s -f can produce this problem.

Example output:

[MKDIR] o/objects/home/bram/program/ccbuild/src/Compiler [CC] Compiler/countFirstLinkerArguments.cc g++ -Wall -g -Werror -Wstrict-null-sentinel -ansi -std=c++0x -c -fopenmp -o "o/objects/home/bram/program/ccbuild/src/Compiler/countFirstLinkerArguments.o" "Compiler/countFirstLinkerArguments.cc" [MKDIR] o/objects/home/bram/program/ccbuild/src/Compiler [MKDIR] o/objects/home/bram/program/ccbuild/src/source [CC] Compiler/ar.cc [CC] source/genDeps.cc g++ -Wall -g -Werror -Wstrict-null-sentinel -ansi -std=c++0x -c -fopenmp -o "o/objects/home/bram/program/ccbuild/src/Compiler/ar.o" "Compiler/ar.cc" g++ -Wall -g -Werror -Wstrict-null-sentinel -ansi -std=c++0x -c -fopenmp -o "o/objects/home/bram/program/ccbuild/src/source/genDeps.o" "source/genDeps.cc" [MKDIR] o/objects/home/bram/program/ccbuild/src/Compiler [CC] Compiler/compileCommand.cc g++ -Wall -g -Werror -Wstrict-null-sentinel -ansi -std=c++0x -c -fopenmp -o "o/objects/home/bram/program/ccbuild/src/Compiler/compileCommand.o" "Compiler/compileCommand.cc" [MKDIR] o/objects/home/bram/program/ccbuild/src/source [CC] source/directDeps.cc

bneijt commented 14 years ago

Won't fix, I've been thinking about this, but I can't see any option to fix it on my end. The terminal (gnome-terminal for me) should do colouring per stream instead.