Prevent duplicate binPath in PATH environment variable
- Check if binPath is already in PATH before adding it. - Add binPath to PATH only if it's not already present. - Log a message when binPath is added to PATH.
This commit is contained in:
parent
1bb215f51b
commit
35215a7fb6
@ -62,5 +62,8 @@ export function getPipxEnvironmentPath(pythonCommand: string): string | null {
|
||||
|
||||
function updateEnvironmentPath(binPath: string): void {
|
||||
// Add BIN path to PATH
|
||||
process.env.PATH = `${binPath}:${process.env.PATH}`;
|
||||
if (process.env.PATH?.indexOf(binPath) === undefined) {
|
||||
process.env.PATH = `${binPath}:${process.env.PATH}`;
|
||||
logger.channel()?.info(`Added ${binPath} to PATH.`);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user