Try using environment variables

This commit is contained in:
Osspial 2019-12-04 02:25:23 -05:00
parent 69d806023a
commit 468970f930
2 changed files with 34 additions and 28 deletions

View File

@ -38,20 +38,22 @@ function install() {
yield exec.exec('rustup', ['self', 'update']);
yield exec.exec('rustup', ['set', 'profile', 'minimal']);
if (os.platform() == 'win32') {
let rustDocsInstalled = false;
{
let installedComponents = '';
const options = {
listeners: {
stdout: (data) => {
installedComponents += data.toString();
}
}
};
yield exec.exec('rustup', ['component', 'list'], options);
rustDocsInstalled = installedComponents.match(/rust-docs.+\(installed\)/) != null;
}
if (rustDocsInstalled) {
let clearedEnvVar = '__SETUP_RUST_ACTION_DEFAULT_INSTALL_CLEARED';
// let rustDocsInstalled = false;
// {
// let installedComponents = '';
// const options = {
// listeners: {
// stdout: (data: Buffer) => {
// installedComponents += data.toString();
// }
// }
// };
// await exec.exec('rustup', ['component', 'list'], options);
// rustDocsInstalled = installedComponents.match(/rust-docs.+\(installed\)/) != null;
// }
// If the rust-docs component isn't installed,
if (process.env[clearedEnvVar] == null) {
let cargoPath = '';
{
const options = {
@ -67,6 +69,7 @@ function install() {
// Github's default Windows install comes with rustup pre-installed with stable, including
// rust-docs. This removes the default stable install so that it doesn't update rust-docs.
yield renameAsync(`${rustupPath}\\toolchains`, `${rustupPath}\\_toolchains`);
yield exec.exec('setx', [clearedEnvVar, "1"]);
}
}
}

View File

@ -24,21 +24,23 @@ export async function install() {
await exec.exec('rustup', ['set', 'profile', 'minimal']);
if (os.platform() == 'win32') {
let rustDocsInstalled = false;
{
let installedComponents = '';
const options = {
listeners: {
stdout: (data: Buffer) => {
installedComponents += data.toString();
}
}
};
await exec.exec('rustup', ['component', 'list'], options);
rustDocsInstalled = installedComponents.match(/rust-docs.+\(installed\)/) != null;
}
let clearedEnvVar = '__SETUP_RUST_ACTION_DEFAULT_INSTALL_CLEARED';
// let rustDocsInstalled = false;
// {
// let installedComponents = '';
// const options = {
// listeners: {
// stdout: (data: Buffer) => {
// installedComponents += data.toString();
// }
// }
// };
// await exec.exec('rustup', ['component', 'list'], options);
// rustDocsInstalled = installedComponents.match(/rust-docs.+\(installed\)/) != null;
// }
if (rustDocsInstalled) {
// If the rust-docs component isn't installed,
if (process.env[clearedEnvVar] == null) {
let cargoPath = '';
{
const options = {
@ -54,6 +56,7 @@ export async function install() {
// Github's default Windows install comes with rustup pre-installed with stable, including
// rust-docs. This removes the default stable install so that it doesn't update rust-docs.
await renameAsync(`${rustupPath}\\toolchains`, `${rustupPath}\\_toolchains`);
await exec.exec('setx', [clearedEnvVar, "1"]);
}
}
}