Skip to content

Exit with code 1 when a file gives an error to close #728 - #741

Merged
mathiasrw merged 2 commits into
mainfrom
fix/728
Oct 22, 2026
Merged

mathiasrw merged 2 commits into
mainfrom
fix/728

Conversation

@mathiasrw

@mathiasrw mathiasrw commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Closes #728

Change

  • error() counts the errors of the run, and engine() resolves with the number of errors. The engine does not touch the exit code.
  • The CLI sets process.exitCode = 1 when the engine resolves with errors. The run goes on, and the process ends with 1 when the last file is done. --halt still stops at the first error.
  • --quiet and --quiet-total only hide the message. The exit code is the same.
Error Exit code With --halt
0 files found 1 1
The file can not be read (EACCES on open) 1 1
The backup can not be made (folder is read-only) 1 1
Two files given, one is changed and one fails 1 1
All goes well 0 0

Tests

  • rr() in test/js/helper.js gives exit: 1 when the engine resolves with errors, like the CLI.
  • Tests that expected exit: null after an error now expect exit: 1.
  • The --halt tests show what --halt changes: the other files are left alone with it, and handled without it.
  • The two exit code tests for -q and -Q in test/cli/run.ai.sh are turned on.

Later

@mathiasrw
mathiasrw merged commit a9023bd into main Oct 22, 2026
7 checks passed
@mathiasrw
mathiasrw deleted the fix/728 branch October 23, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exit code is 0 when a file gives an error

1 participant