From 97ad29e858685728958f737bf3db7fabc4db120d Mon Sep 17 00:00:00 2001 From: Andrew Stapleton Date: Tue, 29 Oct 2024 13:57:48 -0700 Subject: [PATCH] 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) --- tools/verify-rust-version.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/verify-rust-version.js b/tools/verify-rust-version.js index 0d6cf66..85adc60 100644 --- a/tools/verify-rust-version.js +++ b/tools/verify-rust-version.js @@ -18,8 +18,6 @@ const cargo_toml_rust_version = cargo_toml_src.split('\n').filter(l => l.startsW console.log(`Rust version: ${cargo_toml_rust_version}`); -let error = false; - for (const file of files) { const file_content = fs.readFileSync(file, 'UTF8').toString(); const matches1 = file_content.match(re1); @@ -29,7 +27,7 @@ for (const file of files) { for (const match of matches1) { if (match !== cargo_toml_rust_version.substring(0, 4)) { console.error(`Found reference to version ${match}, expected ${cargo_toml_rust_version} in file ${file}`); - error = true; + proc.exitCode = 1; // Non zero code indicates error } } } @@ -38,11 +36,9 @@ for (const file of files) { for (const match of matches2) { if (match !== cargo_toml_rust_version) { console.error(`Found reference to version ${match}, expected ${cargo_toml_rust_version} in ${file}`); - error = true; + proc.exitCode = 1; // Non zero code indicates error } } } } - -proc.exit(error);