Skip to content

Commit becf22a

Browse files
committed
(#176) Execution: use the newer PowerShell by default if available
1 parent 0910868 commit becf22a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1212
- [#22](https://github.com/ant-druha/intellij-powershell/issues/22): the default working directory for a newly created **PowerShell** run configuration is now the script's parent directory
1313

1414
Configurations created by previous versions of the plugin are unchanged.
15+
- [#176: Migrate to PowerShell Core by default](https://github.com/ant-druha/intellij-powershell/issues/176)
16+
17+
If available on the target system, the modern PowerShell will be used be default, if available. Note that only new plugin installations will be affected, due to how we store the plugin settings. If the plugin is already installed, then it will use the previously discovered PowerShell instance.
18+
19+
This is a Windows-only change, because only on Windows there are two PowerShell versions that may coexist.
1520
- [#229](https://github.com/ant-druha/intellij-powershell/issues/229): the **PowerShell** run configuration will now save all the files before executing
1621

1722
This fixes the cases when the started configuration wasn't using the latest version of an edited script file.

src/main/kotlin/com/intellij/plugin/powershell/ide/run/PSExecutionUtil.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ fun findPsExecutable(): String {
1414
val osPath = EnvironmentUtil.getValue("PATH") ?: throw PowerShellNotInstalled("Can not get OS PATH")
1515
val paths = osPath.split(if (SystemInfo.isWindows) ";" else ":")
1616
val suf = if (SystemInfo.isWindows) ".exe" else ""
17-
val exec = arrayListOf("powershell$suf", "pwsh$suf")
18-
paths.forEach { p ->
19-
exec.forEach { e ->
17+
val exec = arrayListOf("pwsh$suf", "powershell$suf")
18+
exec.forEach { e ->
19+
paths.forEach { p ->
2020
val answer = join(p, e)
2121
if (checkExists(answer)) return answer
2222
}

0 commit comments

Comments
 (0)