mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
See `powershell-integration.ps1`. Call operator is space-proof and more reliable. Quote from MSDN: >>> Call operator `&` Runs a command, script, or script block. The call operator, also known as the invocation operator, lets you run commands that are stored in variables and represented by strings or script blocks. >>> https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7.4#call-operator- We also add tests: as we do not have Windows tests in the platform, we use PyCharm infra. Merge-request: KT-MR-19554 Merged-by: Ilya Kazakevich <ilya.kazakevich@jetbrains.com> cherry pick: 6de26e0d88cff45e30d9354a96b62e8b00c7547a (cherry picked from commit 39098ea014d5bf7e5d876c9ab9f6e490519490dd) IJ-CR-152595 GitOrigin-RevId: 6f7ab3b88f7f0a5458953fe1d1783c77bd7d7724
28 lines
1.1 KiB
PowerShell
28 lines
1.1 KiB
PowerShell
# For every _INTELLIJ_FORCE_SET_FOO=BAR run: export FOO=BAR.
|
|
Get-ChildItem env:_INTELLIJ_FORCE_SET_* | ForEach-Object {
|
|
$FullName = $_.Name
|
|
$Name = $FullName -replace '_INTELLIJ_FORCE_SET_',''
|
|
Set-Item -Path "env:\$Name" -Value $_.Value
|
|
Remove-Item "env:$FullName"
|
|
}
|
|
|
|
# For every _INTELLIJ_FORCE_PREPEND_FOO=BAR run: export FOO=BAR$FOO.
|
|
Get-ChildItem env:_INTELLIJ_FORCE_PREPEND_* | ForEach-Object {
|
|
$FullName = $_.Name
|
|
$Name = $FullName -replace '_INTELLIJ_FORCE_PREPEND_',''
|
|
$CurValue = Get-Item "env:$Name"
|
|
Set-Item -Path "env:\$Name" -Value ($_.Value + $CurValue.Value)
|
|
Remove-Item "env:$FullName"
|
|
}
|
|
# `JEDITERM_SOURCE` is executed in its own scope now. That means, it can only run code, and export env vars. It can't export PS variables.
|
|
# It might be better to source it. See MSDN for the difference between "Call operator &" and "Script scope and dot sourcing"
|
|
if (($Env:JEDITERM_SOURCE -ne $null) -and (Test-Path $Env:JEDITERM_SOURCE)) {
|
|
& $Env:JEDITERM_SOURCE
|
|
Remove-Item "env:JEDITERM_SOURCE"
|
|
}
|
|
|
|
$Hooks = "$PSScriptRoot/command-block-support.ps1"
|
|
if (Test-Path $Hooks) {
|
|
& $Hooks
|
|
}
|