diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-03-16 16:18:11 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-03-16 16:18:11 +0100 |
commit | 249c557f1a9e3d796e3f195872acef41a4029f38 (patch) | |
tree | 206b4b6567fa70c09149e7932050a36cabce5923 /openpgp/examples/sign.rs | |
parent | d8b3ac96daed4bc6939c3c2bb3df47247624bda5 (diff) |
openpgp: Fix examples.
- Properly finalize the armor writer.
Diffstat (limited to 'openpgp/examples/sign.rs')
-rw-r--r-- | openpgp/examples/sign.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openpgp/examples/sign.rs b/openpgp/examples/sign.rs index 1a0f61dd..bfef64de 100644 --- a/openpgp/examples/sign.rs +++ b/openpgp/examples/sign.rs @@ -53,11 +53,11 @@ fn main() { // Compose a writer stack corresponding to the output format and // packet structure we want. First, we want the output to be // ASCII armored. - let sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[]) + let mut sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[]) .expect("Failed to create an armored writer."); // Stream an OpenPGP message. - let message = Message::new(sink); + let message = Message::new(&mut sink); // Now, create a signer that emits the signature(s). let mut signer = @@ -79,4 +79,8 @@ fn main() { // Finally, teardown the stack to ensure all the data is written. literal.finalize() .expect("Failed to write data"); + + // Finalize the armor writer. + sink.finalize() + .expect("Failed to write data"); } |