rez icon indicating copy to clipboard operation
rez copied to clipboard

Add shell argument to get_environment and apply

Open triley13 opened this issue 11 months ago • 0 comments

Motivation On windows, get_environ and apply methods on the ResolvedContext class take a very long time when resolving a powershell environment before the cached method.

Image

Explanation This is because append_system_paths method on the Python interpreter creates a new shell from the config defaults. This method trickles up to the _execute method in the ResolvedContext class. Which is then called by apply and get_environ.

Additional Motivation There are other methods on the ResolvedContext class that allows for using shells within the resolved context and would be nice to be able to carry this functionality over.

Proposed Solutions

  • Add a default shell on the Python interpreter class that can be used for Python shell environments when instantiating the executor.
  • Add a argument shell in the append_system_paths and the _execute functions to be passed down as default or override.

Current Workaround

config = create_config()
config.override("default_shell", "cmd")

context.get_environ()

triley13 avatar Mar 12 '25 14:03 triley13