@package-pal/cli
Version:
CLI tool exposing core PackagePal functionality.
17 lines (14 loc) • 438 B
JavaScript
import { exec } from './exec.js';
/**
* @param {string} targetVersion
* @param {string} targetBinPath
*/
export const validateBinaryVersion = (targetVersion, targetBinPath) => {
const stdout = exec(
targetBinPath, ['-v'], 'pipe',
).toString()
.trim();
if (stdout.toLowerCase() !== targetVersion.toLowerCase()) {
throw new Error(`'${targetBinPath}' binary version mismatch; expected ${targetVersion}, got ${stdout}.`);
}
};