Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/lib/src/reboot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ pub(crate) fn reboot() -> anyhow::Result<()> {
// Flush output streams
let _ = std::io::stdout().flush();
let _ = std::io::stderr().flush();
// Wait for the transient unit and pass through its stderr, so that if
// the reboot is refused (e.g. due to an inhibitor) we report an error
// instead of sleeping forever below. Note --wait/--pipe talk to systemd
// via the D-Bus system bus rather than /run/systemd/private, so without
// dbus (e.g. rescue.target) this fails loudly; staged changes are kept.
Command::new("systemd-run")
.args([
"--quiet",
"--wait",
"--pipe",
"--collect",
"--",
"systemctl",
"reboot",
Expand Down