Flush zonefile before running notify command.

This commit is contained in:
Philip Homburg
2025-08-25 15:00:26 +02:00
parent 38a52958c4
commit 0b71f2eedc
+11 -1
View File
@@ -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<T: io::Write, U: io::Write> {
Stdout(Stream<U>),
}
impl<T: io::Write, U: io::Write> FileOrStdout<T, U> {
fn flush(&mut self) -> Result<(), std::io::Error> {
match self {
FileOrStdout::File(f) => f.flush(),
FileOrStdout::Stdout(s) => (s as &Stream<_>).flush(),
}
}
}
impl<T: io::Write, U: io::Write> fmt::Write for FileOrStdout<T, U> {
fn write_str(&mut self, s: &str) -> std::fmt::Result {
match self {