Skip to content

Commit

Permalink
correct download and extract gauge-zip, fixes #1666 (#1669)
Browse files Browse the repository at this point in the history
Signed-off-by: sriv <srikanth.ddit@gmail.com>

Co-authored-by: Nivedha <nivedhasenthil@gmail.com>
  • Loading branch information
sriv and NivedhaSenthil authored Jun 4, 2020
1 parent 61d09d6 commit 6e0d83f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions build/npm/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
const install = require("./install"),
path = require("path"),
unzip = require('unzipper'),
fs = require('fs'),
request = require('superagent'),
packageJsonPath = path.join(__dirname, "..", "package.json"),
binPath = "./bin";
Expand All @@ -14,16 +13,15 @@ const install = require("./install"),
var downloadAndExtract = function(version) {
console.log(`Fetching download url for Gauge version ${version}`);
let url = install.getBinaryUrl(version);
let gaugeExecutable = process.platform === "win32" ? "gauge.exe" : "gauge"
console.log(`Downloading ${url} to ${binPath}`);
return unzip.Open.url(request, url).then((d) => {
return new Promise((resolve, reject) => {
d.files[0].stream()
.pipe(fs.createWriteStream(path.join(binPath, gaugeExecutable)))
.on('error',reject)
.on('finish',resolve)
});
});
return new Promise((resolve, reject) => {
try {
request.get(url).pipe(unzip.Extract({ path: path.normalize(binPath) }));
resolve();
} catch (error) {
reject(error);
}
})
}

install.getVersion(packageJsonPath)
Expand Down

2 comments on commit 6e0d83f

@Jappenn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commento al programma in JavaScript:La funzione di sistema pipe(),che e' utilizzata nell'aprire i descrittori di file, che vengono utilizzati per comunicare tra diversi processi in sistemi con pipelines.La funzione pipe() viene utilizzata per la comunicazione tra processi,tra sistemi con S.O. unix.

@sriv
Copy link
Member Author

@sriv sriv commented on 6e0d83f Apr 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jappenn - I don't understand your comment, but I am guessing you've found an issue due to this commit? Could you please elaborate, and if you have a potential fix, please, you are welcome to raise a PR. Thanks!

Please sign in to comment.