Skip to content

Commit 508c472

Browse files
committed
feat: add backup wget as well for linux
1 parent d774c52 commit 508c472

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/resources/android/android-studios/android-studio.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CreatePlan, DestroyPlan, Resource, ResourceSettings, Utils, getPty, z } from '@codifycli/plugin-core';
1+
import { CreatePlan, DestroyPlan, Resource, ResourceSettings, SpawnStatus, Utils, getPty, z } from '@codifycli/plugin-core';
22
import { OS } from '@codifycli/schemas';
33
import * as fs from 'node:fs/promises';
44
import os from 'node:os';
@@ -189,7 +189,12 @@ export class AndroidStudioResource extends Resource<AndroidStudioConfig> {
189189
const temporaryDir = await fs.mkdtemp(path.join(os.tmpdir(), 'codify-android-'))
190190

191191
try {
192-
await $.spawn(`curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused ${downloadLink.link} -o android-studio.tar.gz`, { cwd: temporaryDir });
192+
const { status: curlStatus } = await $.spawnSafe('curl --version');
193+
if (curlStatus === SpawnStatus.SUCCESS) {
194+
await $.spawn(`curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused ${downloadLink.link} -o android-studio.tar.gz`, { cwd: temporaryDir });
195+
} else {
196+
await $.spawn(`wget -q --tries=5 --waitretry=3 -O android-studio.tar.gz ${downloadLink.link}`, { cwd: temporaryDir });
197+
}
193198
await $.spawn(`tar -xzf android-studio.tar.gz`, { cwd: temporaryDir });
194199

195200
// Remove existing install if present

0 commit comments

Comments
 (0)