-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathshell.js
More file actions
executable file
·25 lines (20 loc) · 829 Bytes
/
shell.js
File metadata and controls
executable file
·25 lines (20 loc) · 829 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
#!/usr/bin/env node
const { spawnSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const binaryName = process.platform === 'win32' ? 'zero_sqlite3.exe' : 'zero_sqlite3';
const binary = path.join(__dirname, 'build', 'Release', binaryName);
if (!fs.existsSync(binary)) {
console.error(`Error: Binary not found at ${binary}`);
console.error('Please run: npm run build-release');
process.exit(1);
}
const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
if (result.error) {
console.error(`Error executing binary: ${result.error.message}`);
if (result.error.code === 'ENOEXEC') {
console.error('The binary may be built for a different platform. Please rebuild with: npm run build-release');
}
process.exit(1);
}
process.exit(result.status ?? 1);