Open brycegbrazen opened 1 month ago
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:version = "1.0.0"
build_command = ""
def commands(): alias('my_alias', 'a_non_existent_executable')
& : 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
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.