I have a sandbox program which uses setrlimit() to limit the output file size of another program run under its control, which I run like so:
sandbox -max 2048 /usr/bin/mono --debug myprogram.exe <p1 >r1 2>r2
The "-max 2048" switch tells the sandbox to limit the output to a maximum of 2K bytes.
If an exception occurs inside "myprogram.exe", or if I deliberately write something to stderr from inside "myprogram.exe", it appears in r2 as expected. However, when the file size limit is exceeded, I get this error message:
File size limit exceeded (core dumped)
but instead of being written to the error log r2 as expected, it comes out on the console. Can anyone tell me why this is happening? Is there any way I can arrange for this message to be written to r2 along with everything else?
It looks like an error that would be reported by the shell, not the program. The shell's stdout/stderr aren't being redirected anywhere.