#!/usr/bin/env node
const { execFileSync } = require('child_process');
const path = require('path');

function getBinaryName(baseName) {
  const platform = process.platform === 'win32' ? 'win' : process.platform;
  const arch = process.arch;
  const platformDir = `${platform}-${arch}`;
  const binaryName = process.platform === 'win32' ? `${baseName}.exe` : baseName;
  return path.join('..', 'binaries', platformDir, binaryName);
}

const binPath = path.join(__dirname, getBinaryName('lc'));
try {
  execFileSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
} catch (e) {
  process.exit(e.status || 1);
}
