diff options
Diffstat (limited to 'pkgs/populate/src/run.rs')
| -rw-r--r-- | pkgs/populate/src/run.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgs/populate/src/run.rs b/pkgs/populate/src/run.rs index bdff78f..9ef60f1 100644 --- a/pkgs/populate/src/run.rs +++ b/pkgs/populate/src/run.rs @@ -387,10 +387,20 @@ impl Context { } /// Releases the lock: the input of the command holding it ending ends - /// the command. + /// the command. Before, the command gets the journal's entries that no + /// command took to the target yet, e.g. of a run that failed, which it + /// appends to the journal. pub fn unlock(&self) { if let Some((mut child, _)) = self.lock.borrow_mut().take() { - drop(child.stdin.take()); + if let Some(mut stdin) = child.stdin.take() { + let (entries, flushed) = &mut *self.entries.borrow_mut(); + let lines: String = entries[*flushed..] + .iter() + .map(|entry| format!("{entry}\n")) + .collect(); + *flushed = entries.len(); + let _ = stdin.write_all(lines.as_bytes()); + } let _ = child.wait(); } } |
