Whether the output stream specified with setOutputStream() is closed by
ArchiveCommand.call() is murky and inconsistent:
- on success, it is closed
- if an exception is encountered when writing the archive, it is closed
- if an exception is encountered when calling createArchiveStream to
open the archive, we forget to close it
Close the output stream consistently to avoid leaks.
Now that the inner try-with-resources doesn't have its own finally
block, this allows us to merge the two try blocks.
It would be even better to never close the output stream. That will
involve more API changes to avoid silently breaking callers, so it is
deferred to a later change.
Change-Id: I0185bdaa60ecee4a541eab5d8ff6c9c4dbe40bf1 Signed-off-by: Jonathan Nieder <jrn@google.com>