Help with tee command

In the current directory , I have seven files .
But when I use the following command , it lists eight files ( 7 files + file_list.xtx)

 
ls -1 | tee file_list.xtx | while read line; do echo $line  ; done

Does the tee command create the file_list.xtx file first and then executes the ls -1 command ?
My understanding was:

  1. First the ls -1 command will get executed listing the 7 files
  2. Entries of all th seven files will be written in a new file created by the tee command (file_list.xtx)
  3. The output of ls -1 command ( entries of 7 files only ) will ve passed to the while loop for further processing

Is my concept wrong ?

Thanks
Kumarjit.

It doesn't have to finish ls before running tee. They end up running simultaneously -- literally so if you have multiple cores.

The easy way to fix this would be to put flie_list.xtx in a different directory.