Skip to content

Wrong exit code for Generate.withFeedback #109

@MattiaVerticchio

Description

@MattiaVerticchio

Hi, I found a little bug when using Generate.withFeedback!
If the script returns an Err, the CLI still exits with code 0, but it should return 1.

Minimal code to reproduce:

module Generate exposing (main)

import Gen.CodeGen.Generate as Generate

main : Program () () ()
main =
    Generate.withFeedback <| \_ -> Err []

Then run elm-codegen run codegen/Generate.elm.

Workaround

A temporary workaround that matches some of the dashes in the error title message.

#!/bin/bash

output=$(elm-codegen run codegen/Generate.elm 2>&1)

echo $output 1>&2

if echo "$output" | grep -q -e "------"; then
  exit 1
else
  exit 0
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions