Try:
$ unbuffer cat /sdlfjsdlfjsld
cat: /sdlfjsdlfjsld: No such file or directory
$ echo $?
0
I don't know if this is intentional, but I believe (and seems to be more logical for me), that the result should be 1. What do you think?
Proposed patch fixes the script when called without '-p' arg. There will be probably also necessary fix behaviour when unbuffer is called with '-p' arg, but I didn't explore that.
Proposed patch (I know it's not against latest CVS, but it's just oneliner...)
Applied with small change: 'wait' is equivalent to 'eval wait', the 'eval' is superfluous here.