From 0b71f2eedcf97dd025ea5e3f28ba17cf09131b75 Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Mon, 25 Aug 2025 15:00:26 +0200 Subject: [PATCH] Flush zonefile before running notify command. --- src/commands/signer.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/signer.rs b/src/commands/signer.rs index 11fe660..6b0b904 100644 --- a/src/commands/signer.rs +++ b/src/commands/signer.rs @@ -432,7 +432,6 @@ impl Signer { todo!(); } if need_resign { - println!("Signing zone"); signer_state.config_modified = signer_config_modified; signer_state.keyset_state_modified = keyset_state_modified; let zonefile_modified = Self::file_modified(sc.zonefile_in.clone())?; @@ -1074,6 +1073,8 @@ impl Signer { } } + writer.flush()?; + if !sc.notify_command.is_empty() { let output = Command::new(&sc.notify_command[0]) .args(&sc.notify_command[1..]) @@ -1534,6 +1535,15 @@ enum FileOrStdout { Stdout(Stream), } +impl FileOrStdout { + fn flush(&mut self) -> Result<(), std::io::Error> { + match self { + FileOrStdout::File(f) => f.flush(), + FileOrStdout::Stdout(s) => (s as &Stream<_>).flush(), + } + } +} + impl fmt::Write for FileOrStdout { fn write_str(&mut self, s: &str) -> std::fmt::Result { match self {