Skip to content

Commit

Permalink
Honor default value true for collectOutput
Browse files Browse the repository at this point in the history
Fixes #2629
  • Loading branch information
eikek committed May 28, 2024
1 parent 870bfd9 commit fd2b897
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private[addons] object RunnerUtil {
): F[AddonResult] =
for {
stdout <-
if (ctx.meta.options.exists(_.collectOutput)) CollectOut.buffer[F]
if (ctx.meta.parseResult) CollectOut.buffer[F]
else CollectOut.none[F].pure[F]
cmdResult <- SysExec(cmd, logger, ctx.baseDir.some)
.flatMap(
Expand All @@ -135,7 +135,7 @@ private[addons] object RunnerUtil {
out <- stdout.get
_ <- logger.debug(s"Addon stdout: $out")
result = Option
.when(ctx.meta.options.exists(_.collectOutput) && out.nonEmpty)(
.when(ctx.meta.parseResult && out.nonEmpty)(
JsonParser
.decode[AddonOutput](out)
.fold(AddonResult.decodingError, AddonResult.success)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ class AddonMetaTest extends CatsEffectSuite with TestLoggingConfig with Fixtures
_ = assertEquals(meta, dummyAddonMeta)
} yield ()
}

test("parse yaml with defaults") {
val yamlStr = """meta:
| name: "test"
| version: "0.1.0"
|""".stripMargin
val meta = AddonMeta.fromYamlString(yamlStr).fold(throw _, identity)
assert(meta.parseResult)
}
}

0 comments on commit fd2b897

Please sign in to comment.