Oh yes, I meant GrandFather's code. I guess the answer is that shell is for humans and programming against it will always be flawed. The number of ways it can fail is quite extensive, eg differences between OSes, differences between versions of the same OS, path not setup correctly, different environment settings etc.
With regards to the code being flawed I was wondering the same thing. Basically the only thing stopping it locking up is that the channel is closed.