Open pmacdonald-falcons opened 3 months ago
I wonder if we can update this
from
cmd = "function %s() { %s @args }" % (key, value)
to
cmd = "function %s { & %s @args }" % (key, value)
I can confirm that replacing the line above does indeed work. I have no idea whether this may break existing alias definitions though!
I think replacing %s()
with %s
(removing ()
) is unnecessary since they both mean "the function doesn't take any parameter). See https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7.4.
As for the &
, in this case it's the call operator.
I would be curious to know if replacing sg
with "sg"
would fix the issue...
So actually this is a little outdated because we did, in fact, replace sg
with "sg"
'. I also tried with no quotes and I receive a similar error. We did everything in our org to sign our CLA https://github.com/AcademySoftwareFoundation/rez/pull/1747.
If I set an alias in my package.py as follows :
The alias errors when entering the rez env for the package.
Before you ask, this approach to creating an alias, which points to a wrapper launcher batch script, allows me to store the alias used to launch the application in an environment variable, which I can then later use to launch the same application via the same rez alias when jobs are executed on deadline. There may be better approaches to this, which may make this issue a moot point.
The batch script "launcher.bat" is as follows:
It takes the first argument and stores it in REZ_USED_ALIAS, then executes the remaining arguments to launch the application.
Environment
To Reproduce
rez env -ci
rez env sg_desktop
Expected behavior I asked chatgpt for a working alias, and it came up with this, which works :
This may be a breaking change for rez to implement as a new way of forming aliases under powershell, but it certainly appears to work for me if I create this alias manually in ps.
Actual behavior Looking at the source of the error, rez appears to be defining the alias as :
This alias raises the error indicated in the description above.