Skip to content

Commit 8d0fefc

Browse files
committed
Refactor binary validation in postinstall script to use fs.accessSync for executable check to address @dangrondahl ai review kosli version false negatives in install.js
1 parent 3dc8c38 commit 8d0fefc

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

npm/wrapper/install.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Postinstall script: validates that the platform binary was installed correctly.
44
// Runs after `npm install @kosli/cli`.
55

6-
const { execFileSync } = require("child_process");
76
const path = require("path");
87
const fs = require("fs");
98

@@ -53,10 +52,10 @@ if (!fs.existsSync(binaryPath)) {
5352
}
5453

5554
try {
56-
execFileSync(binaryPath, ["version"], { stdio: "ignore" });
55+
fs.accessSync(binaryPath, fs.constants.X_OK);
5756
} catch (e) {
5857
process.stderr.write(
59-
`[kosli] Error: binary validation failed: ${e.message}\n` +
58+
`[kosli] Error: binary is not executable: ${e.message}\n` +
6059
`[kosli] Try reinstalling: npm install -g @kosli/cli\n`
6160
);
6261
process.exit(1);

0 commit comments

Comments
 (0)