UNPKG

bsx

Version:

(Looking for the “Base X” package? It's now at [@rniv/base-n](https://www.npmjs.com/package/@rniv/base-n)!)

28 lines (22 loc) 536 B
#!/usr/bin/env node // SPDX-License-Identifier: Unlicense import { platform } from "os"; import { spawn } from "child_process"; import { join } from "path"; let argv = process.argv.slice(2); if (platform() === "win32") { argv = [join(__dirname, "busybox.exe"), ...argv]; } var child = spawn(argv[0], argv.slice(1), { stdio: "inherit", }); child.on("close", code => { process.exit(code); }); ["SIGINT", "SIGTERM"].map(signal => { process.on(signal, () => { if (!child.killed) { child.kill(signal); } }); });