Piping to user application sometimes fail

Hi,

currently, I have a problem in a stress test bash script.

i�m using the following command:

while true; do echo $"command" | ./myprogram; sleep 0.4; done

--> myprogram is watching for stdin via select

The problem is that it will work a couple of times. After that, the stdin fd from the application is going crazy and fires all the time with 100% cpu utilization because there is no valid stdin anymore.

I figured out to use "unbuffer" for this case but it doesn�t solve the problem but it makes is far better (much more tries before error on stdin).

You may want to do "man mkfifo" and write to that and read from that.

See if that makes a difference.

I can't see anything that would explain what you describe. Is it possible the reason lies in your ./myprogram ? Does the same behaviour occur if you put cat in its place?

Aside, watch you quoting.

That's not an "error" -- that's just the way it is. Once it's read all the text there is to read, stdin hits EOF, and your program needs to be able to catch that.