fix: create writestream before http call

This commit is contained in:
Tom Hu 2023-11-10 08:27:28 +11:00
parent 0cb9213bc4
commit affbcb165a
No known key found for this signature in database
GPG key ID: 79155678363963D2
3 changed files with 6 additions and 20 deletions

11
dist/index.js vendored
View file

@ -24596,15 +24596,9 @@ try {
const { execArgs, options, failCi, os, uploaderVersion, verbose } = src_buildExec();
const platform = getPlatform(os);
const filename = external_path_.join(__dirname, getUploaderName(platform));
const filePath = external_fs_.createWriteStream(filename);
external_https_.get(getBaseUrl(platform, uploaderVersion), (res) => {
// Image will be stored at this path
if (external_fs_.existsSync(filename)) {
core.info('IT EXISTS');
}
else {
core.info('IT DOESNT EXIST');
}
const filePath = external_fs_.createWriteStream(filename);
res.pipe(filePath);
filePath
.on('error', (err) => {
core.info(`${console.trace()}`);
@ -24629,7 +24623,6 @@ try {
unlink();
});
}));
res.pipe(filePath);
});
}
catch (err) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -23,16 +23,10 @@ try {
const platform = getPlatform(os);
const filename = path.join( __dirname, getUploaderName(platform));
const filePath = fs.createWriteStream(filename);
https.get(getBaseUrl(platform, uploaderVersion), (res) => {
// Image will be stored at this path
if (fs.existsSync(filename)) {
core.info('IT EXISTS');
} else {
core.info('IT DOESNT EXIST');
}
const filePath = fs.createWriteStream(filename);
res.pipe(filePath);
filePath
.on('error', (err) => {
core.info(`${console.trace()}`);
@ -68,7 +62,6 @@ try {
unlink();
});
});
res.pipe(filePath);
});
} catch (err) {
setFailure(`Codecov: Encountered an unexpected error ${err.message}`, failCi);