Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare bin_path logic for more platforms/architectures #5932

Merged
merged 1 commit into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 3 additions & 9 deletions bsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@
"use strict";

var child_process = require("child_process");
var path = require("path");
var exe = path.join(
__dirname,
process.platform === "darwin" && process.arch === "arm64"
? process.platform + process.arch
: process.platform,
"bsc.exe"
);
var bsc_exe = require("./scripts/bin_path").bsc_exe;

var delegate_args = process.argv.slice(2);

try {
child_process.execFileSync(exe, delegate_args, { stdio: "inherit" });
child_process.execFileSync(bsc_exe, delegate_args, { stdio: "inherit" });
} catch (e) {
if (e.code === "ENOENT") {
console.error(String(e));
Expand Down
8 changes: 5 additions & 3 deletions scripts/bin_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ var path = require("path");

/**
* @type{string}
*
* For compatibility reasons, if the architecture is x64, omit it from the bin directory name.
* So we'll have "darwin", "linux" and "win32" for x64 arch,
* but "darwinarm64" and "linuxarm64" for arm64 arch.
*/
var binDirName =
process.platform === "darwin" && process.arch === "arm64"
? process.platform + process.arch
: process.platform;
process.arch === "x64" ? process.platform : process.platform + process.arch;

/**
*
Expand Down