Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] fix(windows): invalid path when resolving killswitch directory #5633

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/common/services/cancellation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ class CancellationService implements ICancellationService {
}

private static get killSwitchDir(): string {
return path.join(
os.tmpdir(),
process.env.SUDO_USER || process.env.USER || process.env.USERNAME || "",
"KillSwitches"
);
try {
const { username } = os.userInfo();
return path.join(os.tmpdir(), username, "KillSwitches");
} catch (err) {
// os.userInfo throws when there's no username of home directory - we'll default to a generic folder
return path.join(os.tmpdir(), ".nativescript-cli", "KillSwitches");
}
}

private static makeKillSwitchFileName(name: string): string {
Expand Down