2016-02-21 06:35:46 +08:00
|
|
|
function Start-DevPSGitHub
|
2016-02-04 02:53:43 +08:00
|
|
|
{
|
|
|
|
param(
|
|
|
|
[switch]$ZapDisable,
|
|
|
|
[string[]]$ArgumentList = '',
|
|
|
|
[switch]$LoadProfile,
|
2016-02-04 09:25:51 +08:00
|
|
|
[string]$binDir = "$PSScriptRoot\binFull",
|
|
|
|
[switch]$NoNewWindow
|
2016-02-04 02:53:43 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ($LoadProfile -eq $false)
|
|
|
|
{
|
2016-02-04 09:25:51 +08:00
|
|
|
$ArgumentList = @('-noprofile') + $ArgumentList
|
2016-02-04 02:53:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$env:DEVPATH = $binDir
|
|
|
|
if ($ZapDisable)
|
|
|
|
{
|
|
|
|
$env:COMPLUS_ZapDisable = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(Test-Path $binDir\powershell.exe.config))
|
|
|
|
{
|
|
|
|
$configContents = @"
|
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
|
|
<configuration>
|
|
|
|
<runtime>
|
|
|
|
<developmentMode developerInstallation="true"/>
|
|
|
|
</runtime>
|
|
|
|
</configuration>
|
|
|
|
"@
|
|
|
|
$configContents | Out-File -Encoding Ascii $binDir\powershell.exe.config
|
|
|
|
}
|
2016-02-04 09:25:51 +08:00
|
|
|
|
|
|
|
# splatting for the win
|
|
|
|
$startProcessArgs = @{
|
|
|
|
FilePath = "$binDir\powershell.exe"
|
|
|
|
ArgumentList = "$ArgumentList"
|
|
|
|
}
|
2016-02-05 05:19:24 +08:00
|
|
|
|
|
|
|
if ($NoNewWindow) {
|
|
|
|
$startProcessArgs.NoNewWindow = $true
|
|
|
|
$startProcessArgs.Wait = $true
|
|
|
|
}
|
2016-02-04 09:25:51 +08:00
|
|
|
|
|
|
|
Start-Process @startProcessArgs
|
2016-02-04 02:53:43 +08:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
ri env:DEVPATH
|
|
|
|
if ($ZapDisable)
|
|
|
|
{
|
|
|
|
ri env:COMPLUS_ZapDisable
|
|
|
|
}
|
|
|
|
}
|
2016-02-21 06:35:46 +08:00
|
|
|
}
|