You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running an alias using the Powershell shell plugin with rez-env doesn't return a failure exit code when attempting to run a non-existent aliased command in-line.
Environment
Windows 10
Rez 2.112.0
Rez python version 3.7.9
To Reproduce
Create a package.py for a test_invalid_alias package with the following definition:
name = "test_invalid_alias"
version = "1.0.0"
build_command = ""
def commands():
alias('my_alias', 'a_non_existent_executable')
Install the package to your package repository.
Run rez-env -- a_non_existent_executable
Observe the following error message:
& : The term 'a_non_existent_executable' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\bryce.gattis\AppData\Local\Temp\rez_context_2bfjto0k\rez-shell.ps1:4 char:3
+ & a_non_existent_executable
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (a_non_existent_executable:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run rez-env test_invalid_alias -- my_alias
Observe $LASTEXITCODE as being 0 instead of a non-zero exit code.
Use Case
This is currently happening and causing issues on our render farm. With Rez, we are creating aliases for python that map to whatever the DCC's version of python is. For example, the python alias for Houdini maps to hython.
The behavior observed via this issue is problematic when a specific machine doesn't have the correct version of Houdini installed on their machine. Rez will still use the alias (and expect that the corresponding software is installed where the Rez package is looking for it), but will not correctly return a non-zero exit code if the executable is not found.
I had similar problem exposing commands like nuke as an alias for Nuke15.0 etc
The aliases don't seem to propagate any error codes (so even if the command starts, but say it fails mid-render - then farm monitoring software doesn't notice the job failed)
I ended up replacing all aliases with .bat scripts, e.g our nuke.bat contains:
@echo off
"%~dp0\nuke\Nuke15.0.exe" %*
and so on, and these get added to $PATH instead of using Rez's alias(...)
Wrapper scripts like this are slightly less convenient to setup, but they seem a lot more robust - e.g even in bash, aliases have some weird properties which makes them a flaky solution for this problem (mainly they don't get inherited into child shells - so if you did rez env mypackagewithanalias -- my_alias would work but rez env mypackagewithanalias -- bash -c 'myalias' would fail)
Running an alias using the Powershell shell plugin with
rez-env
doesn't return a failure exit code when attempting to run a non-existent aliased command in-line.Environment
To Reproduce
package.py
for atest_invalid_alias
package with the following definition:rez-env -- a_non_existent_executable
rez-env test_invalid_alias -- my_alias
Use Case
This is currently happening and causing issues on our render farm. With Rez, we are creating aliases for
python
that map to whatever the DCC's version ofpython
is. For example, thepython
alias for Houdini maps tohython
.The behavior observed via this issue is problematic when a specific machine doesn't have the correct version of Houdini installed on their machine. Rez will still use the alias (and expect that the corresponding software is installed where the Rez package is looking for it), but will not correctly return a non-zero exit code if the executable is not found.
This causes false positives on our render farm.
Related Issues/PRs
Expected behavior
A non-zero exit code is returned.
Actual behavior
A 0 exit code is returned.
The text was updated successfully, but these errors were encountered: