Skip to content

Commit

Permalink
switching to axios
Browse files Browse the repository at this point in the history
  • Loading branch information
mayaraman19 committed Feb 5, 2024
1 parent 2544330 commit 59c8602
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/commands/src/helpers/dependency-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path';
import fs from 'fs';
import axios from 'axios';
import { executeCliCommand, getCommitBranch, getCommitHash, getPatchId, getRepoDir } from '.';
import { promisify } from 'util';
import { BuildDependencies } from '../../../entities/job';
Expand Down Expand Up @@ -75,10 +76,18 @@ export async function downloadBuildDependencies(
dependencyInfo.dependencies.map(async (dep) => {
commands.push(`curl -SfL ${dep.url} -o ${targetDir}/${dep.filename}`);
try {
await executeCliCommand({
command: 'curl',
args: ['--max-time', '10', '-SfL', dep.url, '-o', `${targetDir}/${dep.filename}`],
options: options,
// await executeCliCommand({
// command: 'curl',
// args: ['--max-time', '10', '-SfL', dep.url, '-o', `${targetDir}/${dep.filename}`],
// options: options,
// });
await axios({
method: 'get',
url: dep.url,
timeout: 10000,
responseType: 'stream',
}).then(async function (response) {
await response.data.pipe(fs.createWriteStream(`${targetDir}/${dep.filename}`));
});
} catch (error) {
console.error(
Expand Down

0 comments on commit 59c8602

Please sign in to comment.