Skip to content

Commit

Permalink
simplify detar
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorfr committed Jun 2, 2019
1 parent b220ee8 commit 3fc1da6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Tasks/YarnInstaller/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import q = require("q");
import * as tl from "azure-pipelines-task-lib/task";
import * as path from "path";
import { IncomingMessage } from "http";
import { extract } from "./detar";
// import { extract } from "./detar";
import { extract as tarExtract, extract } from "tar";

export function downloadFile(url: string, dest: string): q.Promise<any> {
let deferal = q.defer<any>();
Expand Down Expand Up @@ -36,10 +37,15 @@ export function getTempPath(): string {
return tempPath;
}

export function detar(source: string, dest: string): q.Promise<any> {
let deferral = q.defer<any>();
export function detar(source: string, dest: string): PromiseLike<any> {
// let deferral = q.defer<any>();

extract(source, dest, () => deferral.resolve(), err => deferral.reject(err));
return extract({ file: source, cwd: dest });

return deferral.promise;
// return extract({ file: source, cwd: dest })
// .then(() => deferral.resolve())
// .catch(() => deferral.reject());
// extract(source, dest, () => deferral.resolve(), err => deferral.reject(err));

//return deferral.promise;
}

0 comments on commit 3fc1da6

Please sign in to comment.