For the past few weeks I've been making a few daemons able to run as Windows services (which do not have standard input/output). While working on the last one I made a copy'n'paste error (see this post) and the experience has left me realizing that there may be a few ergonomic improvements for non-std{out/err} environments to be made.
It would be nice if there was a way to tell RUST_BACKTRACE
to write its backtrace to other targets. For instance, on Windows there's a OutputDebugString()
function that will send the output to a debugger [if one is attached]. But more generally, it would be helpful it it was possible to dump the backtrace to a file.
Something like RUST_BACKTRACE_TARGET=windbgstr
or RUST_BACKTRACE_TARGET=file:C:\Temp\myservice.backtrace
.
Neither of these would require much in terms of space or complexity, though I realize adding fallible file system I/O to a backtrace dump is a little sketchy..