locate(1) from GNU findutils for a little task and it seems as if it buffers its output. I am piping the output of locate to another task that will process the lines as locate finds them. Since locate might take a long time to run, I thought that locate would print out the files as they were found, but it seems that locate is buffering the output.
If I run locate on a TTY, it prints out the first match immediately, and uses maybe 10 seconds to find the rest of the matches.
If, instead I run locate but pipe to cat, I see nothing until the entire command completes.
It seems that locate buffers the output, and has no way of turning it off.
What I want to achieve is to locate some files, and run a command immediately after finding it by piping the output.
locate something | xargs -n 1 do_something
But what happens is that xargs and hence do_something aren't invoked until find completes.