Skip to content

Aliases on windows (cmd) persist outside of the rez environment #1411

Open
@hughetop

Description

@hughetop

While testing on windows I noticed that the "doskey" macros created with the alias command persist outside of the resulting rez environment. So if you have a package.py file like:

def commands():
    alias('blender', r'"C:\Program Files\Blender Foundation\Blender 3.1\blender.exe"')

Then after doing rez-env blender I can run blender and it will launch Blender. Awesome! The problem is that after exiting the rez environment, the 'blender' alias still exists. This was causing some weird problems when testing with multiple versions of software and multiple softwares. Ideally when the rez environment is exited, it should "unalias" any aliases. On windows, this would be doing doskey blender= to remove the macro.

Environment

  • OS windows 10
  • Rez version 2.111.3
  • Rez python version 3.9.13

To Reproduce

  1. create a package on windows with an alias in commands
  2. go into that rez environment using cmd
  3. exit
  4. run that alias

Expected behavior
The command should not exist since the rez environment was exited.

Actual behavior
It runs the alias, which can error due to the environment being invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugos:windowsWindows-specificshellShell related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions