const { platform, arch } = process;
const INFO = require('../info.json')
const name = INFO.name
const binPath = INFO.platforms.find((p) => p.platform == platform && p.arch == arch)?.bin;
if (binPath) {
const result = require("child_process").spawnSync(
require.resolve(binPath),
process.argv.slice(2),
{ shell: false, stdio: "inherit" },
);
if (result.error) {
throw result.error;
}
process.exitCode = result.status;
} else {
console.error(
`The ${name} CLI package doesn't ship with prebuilt binaries for your platform yet. `
);
process.exitCode = 1;
}