Skip to content

Commit

Permalink
Merge pull request #939 from PowerShell/andschwa/consolehost
Browse files Browse the repository at this point in the history
Converge the console hosts
  • Loading branch information
andyleejordan committed May 17, 2016
2 parents 7c0cfb7 + 64efb9d commit 85f4539
Show file tree
Hide file tree
Showing 59 changed files with 1,085 additions and 3,883 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -7,7 +7,6 @@ matrix:
- os: osx
osx_image: xcode7.3
language: generic
env: PATH+=/usr/local/share/dotnet
git:
submodules: false
before_install:
Expand Down
8 changes: 4 additions & 4 deletions PowerShellGitHubDev.psm1
Expand Up @@ -221,10 +221,10 @@ function New-PSOptions {
[switch]$FullCLR
)

$Top = if ($FullCLR) {
"$PSScriptRoot\src\Microsoft.PowerShell.ConsoleHost"
if ($FullCLR) {
$Top = "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost"
} else {
"$PSScriptRoot/src/Microsoft.PowerShell.CoreConsoleHost"
$Top = "$PSScriptRoot/src/powershell"
}
Write-Verbose "Top project directory is $Top"

Expand Down Expand Up @@ -315,7 +315,7 @@ function Start-PSPester {
[string]$Directory = "$PSScriptRoot/test/powershell"
)

& (Get-PSOutput) -c "Invoke-Pester $Flags $Directory/$Tests"
& (Get-PSOutput) -noprofile -c "Invoke-Pester $Flags $Directory/$Tests"
if ($LASTEXITCODE -ne 0) {
throw "$LASTEXITCODE Pester tests failed"
}
Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Expand Up @@ -33,17 +33,17 @@ test_script:
$ErrorActionPreference = 'Stop'
#
# CoreCLR
$env:CoreOutput = "$pwd\src\Microsoft.PowerShell.CoreConsoleHost\bin\Debug\netcoreapp1.0\win81-x64\publish"
$env:CoreOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish))
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsFile = "$pwd\TestsResults.xml"
& ("$env:CoreOutput\powershell.exe") -c "Invoke-Pester test/powershell -OutputFormat NUnitXml -OutputFile $testResultsFile"
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -c "Invoke-Pester test/powershell -OutputFormat NUnitXml -OutputFile $testResultsFile"
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
#
# FullCLR
$env:FullOutput = "$pwd\src\Microsoft.PowerShell.ConsoleHost\bin\Debug\net451"
$env:FullOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -FullCLR))
Write-Host -Foreground Green 'Run FullCLR tests'
$testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml"
Start-DevPSGitHub -binDir $env:FullOutput -NoNewWindow -ArgumentList '-command', "Import-Module .\src\Modules\Pester; Invoke-Pester test/fullCLR -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR"
Start-DevPSGitHub -binDir $env:FullOutput -NoNewWindow -ArgumentList '-noprofile', '-noninteractive', '-command', "Import-Module .\src\Modules\Pester; Invoke-Pester test/fullCLR -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR"
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFileFullCLR))
#
# Fail the build, if tests failed
Expand Down
4 changes: 2 additions & 2 deletions mapping.json
Expand Up @@ -1187,12 +1187,12 @@
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Archive/ArchiveResources.psd1": "src/Modules/Microsoft.PowerShell.Archive/ArchiveResources.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1": "src/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1": "src/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/CoreClr/Microsoft.PowerShell.Diagnostics.psd1": "src/Microsoft.PowerShell.CoreConsoleHost/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/CoreClr/Microsoft.PowerShell.Diagnostics.psd1": "src/powershell/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1": "src/Microsoft.PowerShell.ConsoleHost/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1": "src/Modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1": "src/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1": "src/Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Utility/CoreClr/Microsoft.PowerShell.Utility.psd1": "src/Microsoft.PowerShell.CoreConsoleHost/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Utility/CoreClr/Microsoft.PowerShell.Utility.psd1": "src/powershell/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1": "src/Microsoft.PowerShell.ConsoleHost/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1",
"src/monad/monad/miscfiles/modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1": "src/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1",
"src/monad/monad/miscfiles/modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1": "src/Modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1",
Expand Down
14 changes: 10 additions & 4 deletions src/Microsoft.PowerShell.ConsoleHost/AssemblyInfo.cs
Expand Up @@ -2,27 +2,33 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
#if !CORECLR
using System.Runtime.ConstrainedExecution;
using System.Security.Permissions;
#endif

#if CORECLR
[assembly:AssemblyCulture("")]
[assembly:NeutralResourcesLanguage("en-US")]

[assembly:InternalsVisibleTo("powershell-tests")]
#else
[assembly:AssemblyConfiguration("")]
[assembly:AssemblyInformationalVersionAttribute (@"10.0.10011.16384")]
[assembly:ReliabilityContractAttribute(Consistency.MayCorruptAppDomain, Cer.MayFail)]
[assembly:AssemblyTitle("Microsoft.PowerShell.ConsoleHost")]
[assembly:AssemblyDescription("Microsoft Windows PowerShell Console Host")]

[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5")]
[assembly:System.Reflection.AssemblyFileVersion("10.0.10011.16384")]
[assembly:AssemblyKeyFileAttribute(@"..\signing\visualstudiopublic.snk")]
[assembly:System.Reflection.AssemblyDelaySign(true)]
#endif

[assembly:System.Runtime.InteropServices.ComVisible(false)]
[assembly:System.Reflection.AssemblyVersion("3.0.0.0")]
[assembly:System.Reflection.AssemblyProduct("Microsoft (R) Windows (R) Operating System")]
[assembly:System.Reflection.AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly:System.Reflection.AssemblyCompany("Microsoft Corporation")]
[assembly:System.Reflection.AssemblyFileVersion("10.0.10011.16384")]
[assembly:AssemblyKeyFileAttribute(@"..\signing\visualstudiopublic.snk")]
[assembly:System.Reflection.AssemblyDelaySign(true)]

internal static class AssemblyStrings
{
Expand Down
Expand Up @@ -118,13 +118,13 @@ internal uint ExitCode
}
}

internal bool ReadFromStdin
internal bool ExplicitReadCommandsFromStdin
{
get
{
Dbg.Assert(dirty, "Parse has not been called yet");

return readFromStdin;
return explicitReadCommandsFromStdin;
}
}

Expand Down Expand Up @@ -365,6 +365,12 @@ private void ParseHelper(string[] args)

switchKey = switchKey.Substring(1);

// chop off the second dash so we're agnostic wrt specifying - or --
if (SpecialCharacters.IsDash(switchKey[0]))
{
switchKey = switchKey.Substring(1);
}

if (MatchSwitch(switchKey, "help", "h") || MatchSwitch(switchKey, "?", "?"))
{
showHelp = true;
Expand Down Expand Up @@ -482,7 +488,7 @@ private void ParseHelper(string[] args)
{
// the arg to -file is -, which is secret code for "read the commands from stdin with prompts"

readFromStdin = true;
explicitReadCommandsFromStdin = true;
noPrompt = false;
}
else
Expand Down Expand Up @@ -844,7 +850,7 @@ private bool ParseCommand(string[] args, ref int i, bool noexitSeen, bool isEnco
{
// the arg to -command is -, which is secret code for "read the commands from stdin with no prompts"

readFromStdin = true;
explicitReadCommandsFromStdin = true;
noPrompt = true;

++i;
Expand All @@ -859,7 +865,7 @@ private bool ParseCommand(string[] args, ref int i, bool noexitSeen, bool isEnco
return false;
}

if (!parent.IsStandardInputRedirected)
if (!Console.IsInputRedirected)
{
ui.WriteErrorLine(CommandLineParameterParserStrings.StdinNotRedirected);
showHelp = true;
Expand Down Expand Up @@ -968,7 +974,7 @@ private bool CollectArgs(string[] args, ref int i)
// default is sta.
private bool? staMode = null;
private bool noExit = true;
private bool readFromStdin;
private bool explicitReadCommandsFromStdin;
private bool noPrompt;
private string commandLineCommand;
private bool wasCommandEncoded;
Expand Down
@@ -1,3 +1,4 @@
#if !PORTABLE
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
Expand Down Expand Up @@ -3685,4 +3686,4 @@ internal enum CHAR_INFO_Attributes : uint
private static PSTraceSource tracer = PSTraceSource.GetTracer("ConsoleControl", "Console control methods");
}
} // namespace

#endif

0 comments on commit 85f4539

Please sign in to comment.