From 314b264513159d347a77691a50e7cc93c4b22c13 Mon Sep 17 00:00:00 2001 From: Lionel Faber Date: Mon, 3 Jan 2022 19:04:54 +0530 Subject: [PATCH] Use USERPROFILE env variable on Windows $HOME is not defined by default on Windows. $USERPROFILE will return the desired value fixes actions-rs/toolchain#185, actions-rs/toolchain#137 --- src/commands/rustup.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/rustup.ts b/src/commands/rustup.ts index 5f6ca64db..6cfe2c8a6 100644 --- a/src/commands/rustup.ts +++ b/src/commands/rustup.ts @@ -90,8 +90,8 @@ export class RustUp { ); } - // `$HOME` should always be declared, so it is more to get the linters happy - core.addPath(path.join(process.env.HOME!, '.cargo', 'bin')); // eslint-disable-line @typescript-eslint/no-non-null-assertion + // `$HOME` or `$USERPROFILE` should always be declared, so it is more to get the linters happy + core.addPath(path.join((process.env.HOME || process.env.USERPROFILE)!, '.cargo', 'bin')); // eslint-disable-line @typescript-eslint/no-non-null-assertion // Assuming it is in the $PATH already return new RustUp('rustup');