stdout output is spooled and buffered to come out at a convienent time. Use stderr to get an immediate message.
//edit: to see what i'm talking about, write a loop which outputs one letter to stdout and then one letter to stderr per iteration. If you output to a file and read it later, you'll notice that instead of it being
o
e
o
e
o
e
o
e
o
e
...
(o for stdout, e for stderr), it's more like this:
e
e
e
e
e
e
e
e
e
e
o
o
o
o
o
o
o
o
o
o
e
e
...