Skip to content

Commit 9994cc6

Browse files
authored
fix(bun): use baseline if current amd64 cpu is missing avx2 (#6434)
1 parent 42617d7 commit 9994cc6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

docs/custom-registries.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Samples:
6767

6868
```txt
6969
https://github.com/oven-sh/bun/releases/download/bun-v1.0.0/bun-linux-x64.zip
70+
https://github.com/oven-sh/bun/releases/download/bun-v1.0.0/bun-linux-x64-baseline.zip
7071
https://github.com/oven-sh/bun/releases/download/bun-v1.0.0/bun-linux-aarch64.zip
7172
https://github.com/oven-sh/bun/releases/download/bun-v1.0.0/SHASUMS256.txt
7273
```

src/cli/tools/bun.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@ export class BunInstallService extends BaseInstallService {
1919

2020
override async install(version: string): Promise<void> {
2121
const baseUrl = `https://github.com/oven-sh/bun/releases/download/bun-v${version}/`;
22-
const filename = `bun-linux-${this.ghArch}.zip`;
22+
let { ghArch } = this;
23+
24+
if (ghArch === 'x64') {
25+
try {
26+
const cpuInfo = await fs.readFile('/proc/cpuinfo', 'utf-8');
27+
if (!cpuInfo.includes('avx2')) {
28+
ghArch = 'x64-baseline';
29+
}
30+
} catch {
31+
ghArch = 'x64-baseline';
32+
}
33+
}
34+
35+
const filename = `bun-linux-${ghArch}.zip`;
2336

2437
const checksumFile = await this.http.download({
2538
url: `${baseUrl}SHASUMS256.txt`,

0 commit comments

Comments
 (0)