Files
zero/bin/zero.js
T
Anandan 442f24c7de Remove Bun installer test dependency (#91)
* Remove Bun installer test dependency

* Harden installer smoke tests

* Stabilize npm wrapper subprocess tests

* Make npm wrapper fixture explicit ESM
2026-06-06 13:58:08 +05:30

36 lines
965 B
JavaScript
Executable File

#!/usr/bin/env node
import { spawnSync } from 'node:child_process';
import { existsSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
function zeroBinaryName(platform = process.platform) {
return platform === 'win32' ? 'zero.exe' : 'zero';
}
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
const nativePath = join(packageRoot, zeroBinaryName());
if (!existsSync(nativePath)) {
console.error(
'[zero] No native binary found next to the npm wrapper. Reinstall the zero package or run `go run ./cmd/zero-release build` from the repository.'
);
process.exit(1);
}
const child = spawnSync(nativePath, process.argv.slice(2), {
stdio: 'inherit',
});
if (child.error) {
console.error(`[zero] Failed to launch wrapper target: ${child.error.message}`);
process.exit(1);
}
if (child.signal) {
process.kill(process.pid, child.signal);
}
process.exit(child.status ?? 1);