Skip to content

Commit

Permalink
fix: Update validation
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu committed Jul 22, 2021
1 parent 6ab08a7 commit 0b4acda
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
20 changes: 12 additions & 8 deletions dist/index.js
Expand Up @@ -13118,21 +13118,25 @@ try {
setFailure(`Codecov: Failed to write uploader binary: ${err.message}`, true);
}).on('finish', () => src_awaiter(void 0, void 0, void 0, function* () {
filePath.close();
yield validate(filename);
yield external_fs_.chmodSync(filename, '777');
validate(filename)
.catch((err) => {
setFailure(`Codecov: Error validating uploader ${err.message}`, true);
}).then(() => src_awaiter(void 0, void 0, void 0, function* () {
yield external_fs_.chmodSync(filename, '777');
yield exec.exec(filename, execArgs, options)
.catch((err) => {
setFailure(`Codecov: Failed to properly upload: ${err.message}`, failCi);
}).then(() => {
unlink();
});
}));
const unlink = () => {
external_fs_.unlink(filename, (err) => {
if (err) {
setFailure(`Codecov: Could not unlink uploader: ${err.message}`, failCi);
}
});
};
yield exec.exec(filename, execArgs, options)
.catch((err) => {
setFailure(`Codecov: Failed to properly upload: ${err.message}`, failCi);
}).then(() => {
unlink();
});
}));
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

29 changes: 18 additions & 11 deletions src/index.ts
Expand Up @@ -40,8 +40,24 @@ try {
}).on('finish', async () => {
filePath.close();

await verify(filename);
await fs.chmodSync(filename, '777');
verify(filename)
.catch((err) => {
setFailure(
`Codecov: Error validating uploader ${err.message}`,
true,
);
}).then(async () => {
await fs.chmodSync(filename, '777');
await exec.exec(filename, execArgs, options)
.catch((err) => {
setFailure(
`Codecov: Failed to properly upload: ${err.message}`,
failCi,
);
}).then(() => {
unlink();
});
});

const unlink = () => {
fs.unlink(filename, (err) => {
Expand All @@ -53,15 +69,6 @@ try {
}
});
};
await exec.exec(filename, execArgs, options)
.catch((err) => {
setFailure(
`Codecov: Failed to properly upload: ${err.message}`,
failCi,
);
}).then(() => {
unlink();
});
});
});
} catch (err) {
Expand Down

0 comments on commit 0b4acda

Please sign in to comment.