Add Start-PSBuild -StopDevPowerShell switch

This commit is contained in:
Sergei Vorobev 2016-07-19 19:09:06 -07:00
parent 3f1ba7a605
commit 738d4ea005

View file

@ -30,6 +30,10 @@ if ($IsLinux) {
function Start-PSBuild {
[CmdletBinding(DefaultParameterSetName='CoreCLR')]
param(
# When specified this switch will stops running dev powershell
# to help avoid compilation error, because file are in use.
[switch]$StopDevPowerShell,
[switch]$NoPath,
[switch]$Restore,
[string]$Output,
@ -70,6 +74,18 @@ function Start-PSBuild {
[string]$Configuration
)
function Stop-DevPowerShell
{
Get-Process powershell* |
Where-Object {
$_.Modules |
Where-Object {
$_.FileName -eq (Resolve-Path $script:Options.Output).Path
}
} |
Stop-Process -Verbose
}
if ($Clean)
{
log "Cleaning your working directory. You can also do it with 'git clean -fdX'"
@ -153,6 +169,11 @@ function Start-PSBuild {
}
$script:Options = New-PSOptions @OptionsArguments
if ($StopDevPowerShell)
{
Stop-DevPowerShell
}
# setup arguments
$Arguments = @()
if ($Publish) {
@ -273,7 +294,6 @@ function Start-PSBuild {
}
function New-PSOptions {
[CmdletBinding()]
param(
@ -729,7 +749,6 @@ function Publish-NuGetFeed
}
}
function Start-DevPowerShell {
param(
[switch]$ZapDisable,