fix: restart the daemon when enabling output capture (#4215)

<!-- Thank you for making a PR! Bug fixes are always welcome, but if
you're adding a new feature or changing an existing one, we'd really
appreciate if you open an issue, post on the forum, or drop in on
Discord -->

## Checks
- [ ] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [ ] I have checked that there are no existing pull requests for the
same thing
This commit is contained in:
Ellie Huxtable
2026-09-21 16:33:53 -07:00
committed by GitHub
parent 9622e574eb
commit 5066e3fceb
2 changed files with 20 additions and 2 deletions
+19 -1
View File
@@ -4,6 +4,9 @@ use eyre::Result;
use toml_edit::{Document, DocumentMut, Item, Table, TableLike, Value};
use tracing::instrument;
#[cfg(feature = "daemon")]
use crate::command::client::daemon;
#[derive(Subcommand, Debug)]
#[command(infer_subcommands = true)]
pub enum Cmd {
@@ -250,7 +253,22 @@ impl EnableCmd {
let updated = self.get_updated_config(&config_str, settings.daemon.enabled)?;
tokio::fs::write(&config_file, &updated).await?;
println!("Enabled. Restart your shell for the change to take effect.");
println!("Enabled.");
// The daemon reads these settings only at startup, so it needs a restart to pick them
// up. A running daemon with autostart off may be externally managed (systemd, launchd),
// so leave that one alone and tell the user instead.
#[cfg(feature = "daemon")]
if settings.daemon.enabled && !settings.daemon.autostart {
println!("Restart the Atuin daemon and your shell for the change to take effect.");
return Ok(());
} else if let Err(e) = daemon::restart_cmd(settings).await {
eprintln!(
"Could not restart the Atuin daemon: {e}\nRun `atuin daemon restart` manually."
);
}
println!("Restart your shell for the change to take effect.");
Ok(())
}
+1 -1
View File
@@ -553,7 +553,7 @@ async fn stop_cmd(settings: &Settings) -> Result<()> {
}
}
async fn restart_cmd(settings: &Settings) -> Result<()> {
pub(super) async fn restart_cmd(settings: &Settings) -> Result<()> {
// Stop if running
match probe(settings).await {
Probe::Ready(_) | Probe::NeedsRestart(_) => {