Skip to content

Commit 97ad29e

Browse files
authored
Fix version check script (#25)
The Version check script started failing on master, but it was also crashing on exit, losing the error message. This fixes the exit code, in the way described in the Node.js documentation [here](https://nodejs.org/api/process.html#processexitcode)
1 parent 397d98f commit 97ad29e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tools/verify-rust-version.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ const cargo_toml_rust_version = cargo_toml_src.split('\n').filter(l => l.startsW
1818

1919
console.log(`Rust version: ${cargo_toml_rust_version}`);
2020

21-
let error = false;
22-
2321
for (const file of files) {
2422
const file_content = fs.readFileSync(file, 'UTF8').toString();
2523
const matches1 = file_content.match(re1);
@@ -29,7 +27,7 @@ for (const file of files) {
2927
for (const match of matches1) {
3028
if (match !== cargo_toml_rust_version.substring(0, 4)) {
3129
console.error(`Found reference to version ${match}, expected ${cargo_toml_rust_version} in file ${file}`);
32-
error = true;
30+
proc.exitCode = 1; // Non zero code indicates error
3331
}
3432
}
3533
}
@@ -38,11 +36,9 @@ for (const file of files) {
3836
for (const match of matches2) {
3937
if (match !== cargo_toml_rust_version) {
4038
console.error(`Found reference to version ${match}, expected ${cargo_toml_rust_version} in ${file}`);
41-
error = true;
39+
proc.exitCode = 1; // Non zero code indicates error
4240
}
4341
}
4442
}
4543

4644
}
47-
48-
proc.exit(error);

0 commit comments

Comments
 (0)