I'm trying to test the error handling in some software, in particular what happens when an error occurs reading from a file or pipe. Is there a simple way to send a certain amount of data to stdout and then generate an I/O error? (I.e., the process doing the reading would see read(2) return -1.) A simple shell recipe would be great, but I don't mind writing code if that's the only way.
Asked
Active
Viewed 182 times
4
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
Doctor J
- 661
- 7
- 9
-
You probably don't mean "read(2) return -1" because that is pretty normal but "errno == EIO". – Hauke Laging May 29 '13 at 23:45