mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 07:22:14 +00:00
Add try catch
This commit is contained in:
parent
1d95b404f2
commit
d4d6125cf2
2 changed files with 28 additions and 15 deletions
22
dist/setup/index.js
vendored
22
dist/setup/index.js
vendored
|
@ -67089,16 +67089,24 @@ function getLinuxInfo() {
|
||||||
function getOSInfo() {
|
function getOSInfo() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let osInfo;
|
let osInfo;
|
||||||
if (exports.IS_WINDOWS) {
|
try {
|
||||||
osInfo = yield getWindowsInfo();
|
if (exports.IS_WINDOWS) {
|
||||||
|
osInfo = yield getWindowsInfo();
|
||||||
|
}
|
||||||
|
else if (exports.IS_LINUX) {
|
||||||
|
osInfo = yield getLinuxInfo();
|
||||||
|
}
|
||||||
|
else if (exports.IS_MAC) {
|
||||||
|
osInfo = yield getMacOSInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (exports.IS_LINUX) {
|
catch (err) {
|
||||||
osInfo = yield getLinuxInfo();
|
const error = err;
|
||||||
|
core.debug(error.message);
|
||||||
}
|
}
|
||||||
else if (exports.IS_MAC) {
|
finally {
|
||||||
osInfo = yield getMacOSInfo();
|
return osInfo;
|
||||||
}
|
}
|
||||||
return osInfo;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getOSInfo = getOSInfo;
|
exports.getOSInfo = getOSInfo;
|
||||||
|
|
21
src/utils.ts
21
src/utils.ts
|
@ -179,13 +179,18 @@ async function getLinuxInfo() {
|
||||||
|
|
||||||
export async function getOSInfo() {
|
export async function getOSInfo() {
|
||||||
let osInfo;
|
let osInfo;
|
||||||
if (IS_WINDOWS) {
|
try {
|
||||||
osInfo = await getWindowsInfo();
|
if (IS_WINDOWS) {
|
||||||
} else if (IS_LINUX) {
|
osInfo = await getWindowsInfo();
|
||||||
osInfo = await getLinuxInfo();
|
} else if (IS_LINUX) {
|
||||||
} else if (IS_MAC) {
|
osInfo = await getLinuxInfo();
|
||||||
osInfo = await getMacOSInfo();
|
} else if (IS_MAC) {
|
||||||
|
osInfo = await getMacOSInfo();
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
const error = err as Error;
|
||||||
|
core.debug(error.message);
|
||||||
|
} finally {
|
||||||
|
return osInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
return osInfo;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue