Skip to content

Commit

Permalink
fix: Tact CLI returns non-zero exit code if compilation fails (#278)
Browse files Browse the repository at this point in the history
skip Node.js's exit codes
https://nodejs.org/docs/v20.12.1/api/process.html#exit-codes;

test non-zero exit code in CI
  • Loading branch information
anton-trunov authored Apr 22, 2024
1 parent 8bac674 commit a9a436d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/tact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ jobs:
then false
fi
- name: Tact CLI non-zero exit code
if: runner.os != 'Windows'
run: |
! ./bin/tact --config test/tact-cli/tact.config.json
- name: Link Tact compiler
run: |
yarn link
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Operation precendence for bitwise operators, equality and comparisons now matches common languages, like JavaScript: PR [#265](https://github.com/tact-lang/tact/pull/265)
- Incorrect variable scoping in `repeat`, `while` and `until` loops: PR [#269](https://github.com/tact-lang/tact/pull/269)
- FunC compilation errors when trying to `dump()` such types as `Cell`, `Slice`, `Builder` and `StringBuilder`: PR [#271](https://github.com/tact-lang/tact/pull/271)
- Tact's CLI returns a non-zero exit code if compilation fails: PR [#278](https://github.com/tact-lang/tact/pull/278)

## [1.2.0] - 2024-02-29

Expand Down
5 changes: 4 additions & 1 deletion bin/tact
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ if (!args["--config"]) {
// Perform compilation
(async () => {
try {
await main.run({
const success = await main.run({
configPath: args["--config"],
projectNames: args["--project"] ? args["--project"] : [],
});
// https://nodejs.org/docs/v20.12.1/api/process.html#exit-codes
if (!success) process.exit(30);
} catch (e) {
console.warn(
"Internal compiler error. Please, report it to https://github.com/tact-lang/tact/issues.",
);
console.log(e);
process.exit(30);
}
})();
3 changes: 3 additions & 0 deletions test/tact-cli/fail.tact
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
contract Fail {
syntax_error
}
10 changes: 10 additions & 0 deletions test/tact-cli/tact.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/grammar/configSchema.json",
"projects": [
{
"name": "fail",
"path": "./fail.tact",
"output": "./output"
}
]
}

0 comments on commit a9a436d

Please sign in to comment.