Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variables containing brackets break powershell shell #1175

Closed
hutchinson opened this issue Dec 10, 2021 · 0 comments
Closed

Environment variables containing brackets break powershell shell #1175

hutchinson opened this issue Dec 10, 2021 · 0 comments

Comments

@hutchinson
Copy link
Contributor

Hi All,

Hope you're all well! First off, thanks for a great library, have really enjoyed getting onboard with it!

We've noticed a small bug when trying to create packages that contain environment variables with brackets in them and launching it in powershell. Here is a small repro case:

name = 'testpackage'
version = '1.0.0'

requires = [
    'platform-windows'
]

build_command = False

def commands():
    env['ENVVARWITH(x86)'] = 'This_breaks_powershell'

Running it with: rez build -i & rez-env testpackage --shell=powershell gives the following error:

[...snip...]
Temp\rez_context_68oyvs1b\context.ps1:53 char:16
+ $Env:ENVVARWITH(x86) = "This_breaks_powershell"
+                ~
Unexpected token '(' in expression or statement.

Looks like using the alternative syntax to set environment variables should work (although I haven't tried it):

Set-Item "env:ENVVARWITH(x86)" "This is fine"
dir env:

Name                           Value
----                           -----
ALLUSERSPROFILE                C:\ProgramData
[...snip...]
ENVVARWITH(x86)                This is fine

Will look to get a PR over to you ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant