in reply to
Re: How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?
in thread How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?
In my system, the final string on STDERR gets printed when the close above is commented; uncommenting the close triggers the fatal error:
And thatís exactly the point: when you have an explicit close, you can make it throw an exception; when you omit the close, the error is silent. But I want to omit the close and still get an exception. Fatal wonít help me there.
Thanks for the pointer about the loop device though! All I can say in retrospect is, díuh. However, Linux has an easier way, mentioned by Zaxo in the old thread from gaal: thereís a /dev/full device where writing always fails with ENOSPC.
Makeshifts last the longest.