From 9cdfa7be770f0ae50acec371663949a23ad6ba96 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Sun, 24 Sep 2023 16:08:57 +0800 Subject: [PATCH] fix assemble again --- .../tech/pegasys/teku/cli/subcommand/GenesisCommand.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/GenesisCommand.java b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/GenesisCommand.java index e2bd0ba3f31..13b05d52c72 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/GenesisCommand.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/GenesisCommand.java @@ -60,9 +60,10 @@ public void generate( final Spec spec = networkOptions.getSpec(); final boolean outputToFile = genesisParams.outputFile != null && !genesisParams.outputFile.isBlank(); - try (final OutputStream fileStream = - outputToFile ? new FileOutputStream(genesisParams.outputFile) : System.out) { + OutputStream fileStream = System.out; + try { if (outputToFile) { + fileStream = new FileOutputStream(genesisParams.outputFile); SUB_COMMAND_LOG.generatingMockGenesis( genesisParams.validatorCount, genesisParams.genesisTime); } @@ -82,6 +83,8 @@ public void generate( if (outputToFile) { SUB_COMMAND_LOG.storingGenesis(genesisParams.outputFile, true); } + } finally { + fileStream.close(); } }