-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinvoke-binary.js
More file actions
41 lines (35 loc) · 1.14 KB
/
Copy pathinvoke-binary.js
File metadata and controls
41 lines (35 loc) · 1.14 KB
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
31
32
33
34
35
36
37
38
39
40
41
const childProcess = require('child_process')
const os = require('os')
const process = require('process')
const VERSION = 'e9d351bd367300ec85b9ba777812c42be2570a64'
function chooseBinary() {
const platform = os.platform()
const arch = os.arch()
if (platform === 'linux' && arch === 'x64') {
return `main-linux-amd64-${VERSION}`
}
if (platform === 'linux' && arch === 'arm64') {
return `main-linux-arm64-${VERSION}`
}
// if (platform === 'windows' && arch === 'x64') {
// return `main-windows-amd64-${VERSION}`
// }
// if (platform === 'windows' && arch === 'arm64') {
// return `main-windows-arm64-${VERSION}`
// }
console.error(`Unsupported platform (${platform}) and architecture (${arch})`)
process.exit(1)
}
function main() {
const binary = chooseBinary()
const mainScript = `${__dirname}/${binary}`
const spawnSyncReturns = childProcess.spawnSync(mainScript, { stdio: 'inherit' })
const status = spawnSyncReturns.status
if (typeof status === 'number') {
process.exit(status)
}
process.exit(1)
}
if (require.main === module) {
main()
}