Start-DevPowerShell: add -Configuration and handle -ArgumentList more properly (#7300)

- Allow specifying the configuration, rather than the `bin` folder.
- Do not attempt to pass null/empty `ArgumentList` to `Start-Process`.
This commit is contained in:
Dan Thompson 2018-07-26 10:30:05 -07:00 committed by Dongbo Wang
parent d97c9e701b
commit e7c315b65c

View file

@ -1858,16 +1858,25 @@ function Publish-NuGetFeed
}
function Start-DevPowerShell {
[CmdletBinding(DefaultParameterSetName='ConfigurationParamSet')]
param(
[string[]]$ArgumentList = '',
[string[]]$ArgumentList = @(),
[switch]$LoadProfile,
[string]$binDir = (Split-Path (New-PSOptions).Output),
[Parameter(ParameterSetName='ConfigurationParamSet')]
[ValidateSet("Debug", "Release", "CodeCoverage", '')] # should match New-PSOptions -Configuration values
[string]$Configuration,
[Parameter(ParameterSetName='BinDirParamSet')]
[string]$BinDir,
[switch]$NoNewWindow,
[string]$Command,
[switch]$KeepPSModulePath
)
try {
if (-not $BinDir) {
$BinDir = Split-Path (New-PSOptions -Configuration $Configuration).Output
}
if ((-not $NoNewWindow) -and ($Environment.IsCoreCLR)) {
Write-Warning "Start-DevPowerShell -NoNewWindow is currently implied in PowerShellCore edition https://github.com/PowerShell/PowerShell/issues/1543"
$NoNewWindow = $true
@ -1888,12 +1897,16 @@ function Start-DevPowerShell {
$ArgumentList = $ArgumentList + @("-command $Command")
}
$env:DEVPATH = $binDir
$env:DEVPATH = $BinDir
# splatting for the win
$startProcessArgs = @{
FilePath = "$binDir\pwsh"
ArgumentList = "$ArgumentList"
FilePath = "$BinDir\pwsh"
}
if ($ArgumentList) {
$startProcessArgs.ArgumentList = $ArgumentList
}
if ($NoNewWindow) {