Skip to content

Commit b08bb00

Browse files
07souravkundafrancisf
authored andcommitted
handle downloadSync for windows < 10
1 parent a9f965b commit b08bb00

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

lib/LocalBinary.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,25 @@ function LocalBinary(){
8787
});
8888
}
8989

90-
const cmd = `curl`;
91-
const opts = ['-o', binaryPath, options.href];
90+
const osPlatform = os.platform();
91+
const osVersion = parseInt(os.release());
9292

93-
if(conf.proxyHost && conf.proxyPort) {
94-
opts.push('--proxy', `${conf.proxyHost}:${conf.proxyPort}`);
93+
let cmd, opts;
94+
95+
if(osPlatform.includes('win') && osVersion < 10) {
96+
cmd = 'wget';
97+
opts = [];
98+
if(conf.proxyHost && conf.proxyPort) {
99+
opts.push('-e', `https_proxy=${conf.proxyHost}:${conf.proxyPort}`, "--no-check-certificate");
100+
}
101+
opts.push('-O', binaryPath, options.href);
102+
}else{
103+
cmd = `curl`;
104+
opts = ['-o', binaryPath, options.href];
105+
106+
if(conf.proxyHost && conf.proxyPort) {
107+
opts.push('--proxy', `${conf.proxyHost}:${conf.proxyPort}`);
108+
}
95109
}
96110

97111
try{

0 commit comments

Comments
 (0)