Fix crash when no version found
This commit is contained in:
parent
d3f7e79d54
commit
528b040d7e
2 changed files with 54 additions and 43 deletions
47
dist/index.js
vendored
47
dist/index.js
vendored
|
@ -1291,27 +1291,32 @@ function getVariable(variableName) {
|
|||
}
|
||||
function downloadLinuxCpython(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const home = yield getVariable('HOME');
|
||||
yield exec.exec('bash', [
|
||||
'-c',
|
||||
`
|
||||
set -e # Any command which returns non-zero exit code will cause this shell script to exit immediately
|
||||
set -x # Activate debugging to show execution details: all commands will be printed before execution
|
||||
|
||||
sudo apt-get install build-essential checkinstall
|
||||
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
|
||||
|
||||
cd $HOME
|
||||
wget https://www.python.org/ftp/python/${version}/Python-${version}.tgz
|
||||
|
||||
tar -xvf Python-${version}.tgz
|
||||
cd Python-${version}
|
||||
./configure
|
||||
make
|
||||
sudo checkinstall -y
|
||||
`
|
||||
]);
|
||||
return `${home}/Python-${version}`;
|
||||
try {
|
||||
const home = yield getVariable('HOME');
|
||||
yield exec.exec('bash', [
|
||||
'-c',
|
||||
`
|
||||
set -e # Any command which returns non-zero exit code will cause this shell script to exit immediately
|
||||
set -x # Activate debugging to show execution details: all commands will be printed before execution
|
||||
|
||||
sudo apt-get install build-essential checkinstall
|
||||
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
|
||||
|
||||
cd $HOME
|
||||
wget https://www.python.org/ftp/python/${version}/Python-${version}.tgz
|
||||
|
||||
tar -xvf Python-${version}.tgz
|
||||
cd Python-${version}
|
||||
./configure
|
||||
make
|
||||
sudo checkinstall -y
|
||||
`
|
||||
]);
|
||||
return `${home}/Python-${version}`;
|
||||
}
|
||||
catch (_a) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.downloadLinuxCpython = downloadLinuxCpython;
|
||||
|
|
|
@ -16,28 +16,34 @@ async function getVariable(variableName: string): Promise<string> {
|
|||
return variableValue.trim();
|
||||
}
|
||||
|
||||
export async function downloadLinuxCpython(version: string): Promise<string> {
|
||||
const home = await getVariable('HOME');
|
||||
export async function downloadLinuxCpython(
|
||||
version: string
|
||||
): Promise<string | null> {
|
||||
try {
|
||||
const home = await getVariable('HOME');
|
||||
|
||||
await exec.exec('bash', [
|
||||
'-c',
|
||||
`
|
||||
set -e # Any command which returns non-zero exit code will cause this shell script to exit immediately
|
||||
set -x # Activate debugging to show execution details: all commands will be printed before execution
|
||||
|
||||
sudo apt-get install build-essential checkinstall
|
||||
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
|
||||
await exec.exec('bash', [
|
||||
'-c',
|
||||
`
|
||||
set -e # Any command which returns non-zero exit code will cause this shell script to exit immediately
|
||||
set -x # Activate debugging to show execution details: all commands will be printed before execution
|
||||
|
||||
sudo apt-get install build-essential checkinstall
|
||||
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
|
||||
|
||||
cd $HOME
|
||||
wget https://www.python.org/ftp/python/${version}/Python-${version}.tgz
|
||||
|
||||
tar -xvf Python-${version}.tgz
|
||||
cd Python-${version}
|
||||
./configure
|
||||
make
|
||||
sudo checkinstall -y
|
||||
`
|
||||
]);
|
||||
|
||||
cd $HOME
|
||||
wget https://www.python.org/ftp/python/${version}/Python-${version}.tgz
|
||||
|
||||
tar -xvf Python-${version}.tgz
|
||||
cd Python-${version}
|
||||
./configure
|
||||
make
|
||||
sudo checkinstall -y
|
||||
`
|
||||
]);
|
||||
|
||||
return `${home}/Python-${version}`;
|
||||
return `${home}/Python-${version}`;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue