Skip to content

Commit

Permalink
fix(#144): return non-zero exit code on template generation failure i…
Browse files Browse the repository at this point in the history
…n non-watch mode

* return error when generation fails

* fix: return non-zero exit code on failure in non-watch mode

---------

Co-authored-by: Adrian Hesketh <[email protected]>

Fixes (#144)
  • Loading branch information
veggiemonk authored Sep 11, 2023
1 parent 4f2b0bc commit 331bd73
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/templ/generatecmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ func runCmd(ctx context.Context, args Arguments) (err error) {
if errors.Is(errs[0], context.Canceled) {
return errs[0]
}
if !args.Watch {
return fmt.Errorf("failed to process path: %v", errors.Join(errs...))
}
fmt.Printf("Error processing path: %v\n", errors.Join(errs...))
}
if changesFound > 0 {
Expand Down

0 comments on commit 331bd73

Please sign in to comment.