TEE command appending null characters to output

Aug 19, 2009
26
1
Hello

The TEE command seems to be appending a null character to the text that it appends to the output files. I first noticed this with TCC 26.01.38, and the behaviour is still present in TCC 26.01.39

For example, executing this and then viewing the output file in something like NotePad++ will reveal a null character at the end of the line:

echo hello | tee test.txt

Chris
 
May 20, 2008
10,679
83
Syracuse, NY, USA
Yup.

1589264687473.png
 
Aug 19, 2009
26
1
If anyone else falls foul of this problem, you can work around it by piping the resulting file through the TPIPE command, using the option to remove binary characters.

In my case, I was piping the output from Perforce's P4 command to both the screen and a temporary file, and then using the FIND command to filter out the "info" and "exit" responses from the Perforce server:

p4 ... | TEE temp.txt
TYPE temp.txt | find /v /i "info:" | find /v /i "exit:" > error.txt


The FIND command was confused by the presence of the null characters. Replacing TYPE with TPIPE will work around the problem:

TPIPE /input=error.txt /simple=13 | find /v /i ...

Chris