This PR tightens our checking of stderr and will cause tests to fail if there is any unexpected message in stderr: - commit Write stdout/stderr to datadir instead of temp file writes stderr to a file in the datadir instead of a temporary file. This helps with debugging in the case of failure. - commit Use LIBC_FATAL_STDERR=1 in tests ensures that libc failures are logged to stderr instead of the terminal.
Backport of core PR12755
https://github.com/bitcoin/bitcoin/pull/12755/files