Skip to content
Open
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
10 changes: 8 additions & 2 deletions package/bin/electrobun.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

const { execSync, spawn } = require('child_process');
const { spawn } = require('child_process');
const { existsSync, mkdirSync, unlinkSync, chmodSync, copyFileSync, createWriteStream } = require('fs');
const { join, dirname } = require('path');
const https = require('https');
Expand Down Expand Up @@ -98,7 +98,13 @@ async function ensureCliBinary() {
await downloadFile(tarballUrl, tarballPath);

// Extract using system tar (available on macOS, Linux, and Windows 10+)
execSync(`tar -xzf "${tarballPath}"`, { cwd: cacheDir, stdio: 'pipe' });
const result = Bun.spawnSync(['tar', '-xzf', tarballPath], {
cwd: cacheDir,
stdio: 'pipe'
});
if (!result.success) {
throw new Error(`Failed to extract tarball: ${result.stderr?.toString() || 'Unknown error'}`);
}

// Clean up tarball
unlinkSync(tarballPath);
Expand Down