Skip to content

Commit 727b22d

Browse files
Adding core compatibility
1 parent 2341a50 commit 727b22d

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

PSModuleDevelopment/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- Upd: Template PSFTests - Added localization string tests
1010
- Upd: Remove-PSMDTemplate - Refactored and updated messaging / ShouldProcess implementation
1111
- Upd: Find-PSMDFileContent - Updated extension filtering to be configurable and include .cs files by default.
12+
- Upd: Get-PSMDArgumentCompleter - Refactoring and minor performance improvement
13+
- Upd: Restart-PSMDShell - Will restart same application as current process, enabling it to restart on core versions
1214
- Fix: Template PSFProject - Publish Folder created during build is created using `-Force`
1315
- Fix: Template PSFProject - Cleaning up Azure Function conversion
1416
- Fix: Template PSFTests - Encoding test no longer fails on core (#104)

PSModuleDevelopment/functions/utility/Restart-PSMDShell.ps1

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,26 @@
5151
$NoProfile
5252
)
5353

54-
if ($PSCmdlet.ShouldProcess("Current shell", "Restart"))
54+
begin
5555
{
56-
if ($NoProfile)
57-
{
58-
if ($Admin) { Start-Process powershell.exe -Verb RunAs -ArgumentList '-NoProfile' }
59-
else { Start-Process powershell.exe -ArgumentList '-NoProfile' }
60-
}
61-
else
56+
$powershellPath = (Get-Process -id $pid).Path
57+
}
58+
process
59+
{
60+
if ($PSCmdlet.ShouldProcess("Current shell", "Restart"))
6261
{
63-
if ($Admin) { Start-Process powershell.exe -Verb RunAs }
64-
else { Start-Process powershell.exe }
62+
if ($NoProfile)
63+
{
64+
if ($Admin) { Start-Process $powershellPath -Verb RunAs -ArgumentList '-NoProfile' }
65+
else { Start-Process $powershellPath -ArgumentList '-NoProfile' }
66+
}
67+
else
68+
{
69+
if ($Admin) { Start-Process $powershellPath -Verb RunAs }
70+
else { Start-Process $powershellPath }
71+
}
72+
if (-not $NoExit) { exit }
6573
}
66-
if (-not $NoExit) { exit }
6774
}
6875
}
6976
New-Alias -Name Restart-Shell -Value Restart-PSMDShell -Option AllScope -Scope Global

0 commit comments

Comments
 (0)