Expand description
The runtime’s one way to write a line to standard output or standard error.
println! and friends panic when the write fails, and panic = "abort" in the release
profile turns that panic into SIGABRT at the print site — no unwind, no destructors, no
session_end. A reader that takes the readiness line mur run --json writes and then closes
the pipe is the ordinary success case, and every later write to that stream fails. Nothing
here panics on a write error.
A line the stream refused is not discarded where it can be kept: it goes to
<records dir>/logs/bootstrap.log through [crate::agent::append_bootstrap_log], the same
file the rest of the runtime’s bootstrap diagnostics land in. Before a session’s records
directory exists there is nowhere else to put it and the line is dropped — the warnings that
fire during staging say so in their own doc comments.
Nothing here touches the broken-pipe signal. Rust’s default is to ignore it, and that default
is what turns a write to a closed pipe into an EPIPE this module can handle rather than an
immediate kill. Restoring the system default disposition would trade the abort for death by
signal, which is the same loss.
It is also the mur CLI’s one way to write report output — what a short-lived command such
as mur trace show or mur ps prints for its reader — through report_to_stdout,
report_to_stderr and the report_println! family. A report line has no session to fall
back to, so a stream that refuses one is latched closed: every later report write to it is
dropped without a syscall, and the command finishes its work and exits with its own status.
A closed reader is the end of the output, not a failure. A stdout write that fails for any
other reason, such as ENOSPC on a redirect to a full disk, is recorded once and read back
with stdout_failure, so the command can be reported as failed after it has finished.
Enums§
- Emitted
- What became of one diagnostic line.
Functions§
- credential_
to_ stdout to_stdoutfor a line that carries a credential, such as a door token. A line the stream refuses isEmitted::Dropped, never appended tologs/bootstrap.log: a credential written into the session directory would outlive the one reader it was printed for.- diagnostic_
workdir - The armed fallback directory’s host path, or
Nonewhen no records directory exists yet. - document_
to_ stdout - Write
documentverbatim to the real standard output, whateversend_stdout_to_stderrset, with the same refusal handling asreport_to_stdout. - raw_
to_ stdout - Write
chunkto standard output exactly as given, adding no newline. - report_
to_ stderr report_to_stdoutfor standard error. A refusal of any kind only latches the stream: there is nowhere left to report it.- report_
to_ stdout - Write
bytesverbatim to standard output as report output, and flush. - send_
stdout_ to_ stderr - From now on, for the rest of the process, send every line this module writes to standard output
—
to_stdout,credential_to_stdout,raw_to_stdout,report_to_stdoutand the macros over them — to standard error instead. - set_
diagnostic_ workdir - Arm the fallback with this session’s records directory — the one that holds
logs/, outside the workdir a capsule sees as".". - stdout_
closed - Whether a report write to standard output has failed. A command rendering a long report may stop early once this is true; nothing it writes afterwards reaches the stream.
- stdout_
failure - The first report write error on standard output that was not
BrokenPipe, orNonewhen every report write succeeded or the reader merely went away. - to_
stderr - Write
lineand a newline to standard error. - to_
stdout - Write
lineand a newline to standard output.