#!/usr/bin/env node
const { spawnSync } = require("node:child_process");
const path = require("node:path");

if (process.platform !== "win32") {
  console.error("regen-mde uninstaller is only available on Windows.");
  process.exit(1);
}

const root = path.resolve(__dirname, "..");
const result = spawnSync(process.execPath, [
  path.join(root, "bin", "postinstall.js"),
  "--uninstall",
], {
  stdio: "inherit",
  cwd: root,
});

process.exit(result.status ?? 1);
