Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions npm/shellroute/bin/shellroute
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#!/usr/bin/env node
const { execFileSync } = require("child_process");
const path = require("path");
const os = require("os");
var execFileSync = require("child_process").execFileSync;
var path = require("path");
var os = require("os");

const PLATFORMS = {
var PLATFORMS = {
"darwin-arm64": "@shellroute/cli-darwin-arm64",
"darwin-x64": "@shellroute/cli-darwin-x64",
"linux-arm64": "@shellroute/cli-linux-arm64",
"linux-x64": "@shellroute/cli-linux-x64",
};

const key = `${os.platform()}-${os.arch()}`;
const pkg = PLATFORMS[key];
var key = os.platform() + "-" + os.arch();
var pkg = PLATFORMS[key];
if (!pkg) {
console.error(`Unsupported platform: ${key}`);
console.error("Unsupported platform: " + key);
process.exit(1);
}

try {
const binPath = path.join(require.resolve(`${pkg}/package.json`), "..", "bin", "shellroute");
var binPath = path.join(require.resolve(pkg + "/package.json"), "..", "bin", "shellroute");
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
} catch (e) {
process.exit(e.status ?? 1);
process.exit(e.status != null ? e.status : 1);
}