-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathbin.js
More file actions
30 lines (24 loc) · 949 Bytes
/
bin.js
File metadata and controls
30 lines (24 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env node
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { spawnSync } = require("child_process");
const path = require("path");
const platform = process.platform;
const arch = process.arch;
const platformArch = `${platform}-${arch}`;
const packageName = `@microsoft/inshellisense-${platformArch}`;
const binaryName = platform === "win32" ? `inshellisense-${platformArch}.exe` : `inshellisense-${platformArch}`;
try {
const platformPkgPath = require.resolve(`${packageName}/package.json`);
const platformPkgDir = path.dirname(platformPkgPath);
const binaryPath = path.join(platformPkgDir, binaryName);
const result = spawnSync(binaryPath, process.argv.slice(2), {
stdio: "inherit",
shell: false,
});
process.exit(result.status ?? 1);
} catch (err) {
console.error(`inshellisense: Platform ${platformArch} is not supported.`);
console.error(err.message);
process.exit(1);
}