mirror of
https://github.com/actions/setup-python.git
synced 2025-04-20 03:53:30 +00:00
Fix crash when no version found
This commit is contained in:
parent
d3f7e79d54
commit
528b040d7e
5
dist/index.js
vendored
5
dist/index.js
vendored
@ -1291,6 +1291,7 @@ function getVariable(variableName) {
|
|||||||
}
|
}
|
||||||
function downloadLinuxCpython(version) {
|
function downloadLinuxCpython(version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
const home = yield getVariable('HOME');
|
const home = yield getVariable('HOME');
|
||||||
yield exec.exec('bash', [
|
yield exec.exec('bash', [
|
||||||
'-c',
|
'-c',
|
||||||
@ -1312,6 +1313,10 @@ function downloadLinuxCpython(version) {
|
|||||||
`
|
`
|
||||||
]);
|
]);
|
||||||
return `${home}/Python-${version}`;
|
return `${home}/Python-${version}`;
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.downloadLinuxCpython = downloadLinuxCpython;
|
exports.downloadLinuxCpython = downloadLinuxCpython;
|
||||||
|
@ -16,7 +16,10 @@ async function getVariable(variableName: string): Promise<string> {
|
|||||||
return variableValue.trim();
|
return variableValue.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadLinuxCpython(version: string): Promise<string> {
|
export async function downloadLinuxCpython(
|
||||||
|
version: string
|
||||||
|
): Promise<string | null> {
|
||||||
|
try {
|
||||||
const home = await getVariable('HOME');
|
const home = await getVariable('HOME');
|
||||||
|
|
||||||
await exec.exec('bash', [
|
await exec.exec('bash', [
|
||||||
@ -40,4 +43,7 @@ export async function downloadLinuxCpython(version: string): Promise<string> {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return `${home}/Python-${version}`;
|
return `${home}/Python-${version}`;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user