From d948bf60d0465ef683eba243b32e9239f64ab7ed Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 12 Oct 2017 15:56:26 -0700 Subject: [PATCH 1/7] [feature] renamed powershell.exe to pwsh.exe --- .spelling | 1 + build.psm1 | 14 +++++++------- demos/Raspberry-Pi/README.md | 2 +- demos/SSHRemoting/README.md | 6 +++--- .../host/msh/ConsoleHost.cs | 2 +- .../host/msh/ConsoleHostRawUserInterface.cs | 2 +- .../host/msh/ConsoleHostUserInterface.cs | 2 +- .../host/msh/ConsoleHostUserInterfaceSecurity.cs | 2 +- .../ScheduledJobDefinition.cs | 2 +- .../CoreCLR/CorePsAssemblyLoadContext.cs | 2 +- .../FormatAndOutput/out-console/OutConsole.cs | 2 +- .../engine/Modules/ModuleIntrinsics.cs | 4 ++-- .../engine/hostifaces/MshHost.cs | 2 +- .../hostifaces/PowerShellProcessInstance.cs | 6 +++--- .../remoting/common/RunspaceConnectionInfo.cs | 8 ++++---- .../remoting/fanin/OutOfProcTransportManager.cs | 2 +- .../Install-PowerShellRemoting.ps1 | 2 +- src/powershell-unix/powershell-unix.csproj | 2 +- .../powershell-win-core.csproj | 2 +- test/docker/networktest/DockerRemoting.Tests.ps1 | 6 +++--- test/docker/networktest/Dockerfile | 4 ++-- test/powershell/Host/Base-Directory.Tests.ps1 | 2 +- test/powershell/Host/ConsoleHost.Tests.ps1 | 16 ++++++++-------- test/powershell/Host/Read-Host.Tests.ps1 | 2 +- .../Language/Parser/Conversions.Tests.ps1 | 2 +- .../Language/Parser/UsingAssembly.Tests.ps1 | 8 ++++---- .../NativeCommandProcessor.Tests.ps1 | 6 +++--- .../NativeExecution/NativeStreams.Tests.ps1 | 2 +- .../Import-Module.Tests.ps1 | 4 ++-- .../Out-Default.Tests.ps1 | 2 +- .../FileSystem.Tests.ps1 | 2 +- .../Set-Service.Tests.ps1 | 14 +++++++------- .../Set-PSBreakpoint.Tests.ps1 | 2 +- .../Write-Host.Tests.ps1 | 2 +- .../XMLCommand.Tests.ps1 | 4 ++-- .../object.tests.ps1 | 2 +- .../Microsoft.WSMan.Management/CredSSP.Tests.ps1 | 2 +- .../Provider/Pester.AutomountedDrives.Tests.ps1 | 16 ++++++++-------- test/powershell/README.md | 2 +- test/powershell/SDK/PSDebugging.Tests.ps1 | 2 +- test/powershell/engine/Job/Jobs.Tests.ps1 | 2 +- .../engine/Module/ModulePath.Tests.ps1 | 4 ++-- .../ParameterBinding/ParameterBinding.Tests.ps1 | 2 +- .../Start-CodeCoverageRun.ps1 | 2 +- test/tools/OpenCover/OpenCover.psm1 | 10 +++++----- 45 files changed, 94 insertions(+), 93 deletions(-) diff --git a/.spelling b/.spelling index 3b415b9aef5..96fda43c39d 100644 --- a/.spelling +++ b/.spelling @@ -147,6 +147,7 @@ psobjects psproxyjobs PSReadline PSSessionConfiguration +pwsh redistributables Register-EngineEvent Register-PSSessionConfiguration diff --git a/build.psm1 b/build.psm1 index c89c4e019a6..43abc2d8c79 100644 --- a/build.psm1 +++ b/build.psm1 @@ -187,7 +187,7 @@ function Start-BuildNativeWindowsBinaries { return } - # cmake is needed to build powershell.exe + # cmake is needed to build pwsh.exe if (-not (precheck 'cmake' $null)) { throw 'cmake not found. Run "Start-PSBootstrap -BuildWindowsNative". You can also install it from https://chocolatey.org/packages/cmake' } @@ -497,7 +497,7 @@ Fix steps: Start-TypeGen } - # Get the folder path where powershell.exe is located. + # Get the folder path where pwsh.exe is located. $publishPath = Split-Path $Options.Output -Parent try { # Relative paths do not work well if cwd is not changed to project @@ -507,7 +507,7 @@ Fix steps: if ($CrossGen) { Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime - log "PowerShell.exe with ngen binaries is available at: $($Options.Output)" + log "pwsh.exe with ngen binaries is available at: $($Options.Output)" } else { log "PowerShell output: $($Options.Output)" } @@ -680,9 +680,9 @@ function New-PSOptions { } $Executable = if ($Environment.IsLinux -or $Environment.IsMacOS) { - "powershell" + "pwsh" } elseif ($Environment.IsWindows) { - "powershell.exe" + "pwsh.exe" } # Build the Output path @@ -837,7 +837,7 @@ function Start-PSPester { [string[]]$Path = @("$PSScriptRoot/test/common","$PSScriptRoot/test/powershell"), [switch]$ThrowOnFailure, [string]$binDir = (Split-Path (New-PSOptions).Output), - [string]$powershell = (Join-Path $binDir 'powershell'), + [string]$powershell = (Join-Path $binDir 'pwsh'), [string]$Pester = ([IO.Path]::Combine($binDir, "Modules", "Pester")), [Parameter(ParameterSetName='Unelevate',Mandatory=$true)] [switch]$Unelevate, @@ -848,7 +848,7 @@ function Start-PSPester { [switch]$IncludeFailingTest ) - if (-not (Get-Module -ListAvailable -Name $Pester -ErrorAction SilentlyContinue)) + if (-not (Get-Module -ListAvailable -Name $Pester -ErrorAction SilentlyContinue)) { Write-Warning @" Pester module not found. diff --git a/demos/Raspberry-Pi/README.md b/demos/Raspberry-Pi/README.md index 0e528f1dfa1..6a6a5fff1c8 100644 --- a/demos/Raspberry-Pi/README.md +++ b/demos/Raspberry-Pi/README.md @@ -72,7 +72,7 @@ cp shared/Microsoft.NetCore.App/2.1.0-preview1-25719-04/* ~/powershell ## Start PowerShell ```bash -~/powershell/powershell +~/powershell/pwsh ``` Note that until arm32 is [fully supported by CoreCLR](https://github.com/dotnet/coreclr/issues/3977), it's not supported by PowerShell Core. diff --git a/demos/SSHRemoting/README.md b/demos/SSHRemoting/README.md index 25f93922f32..a0cbbf46086 100644 --- a/demos/SSHRemoting/README.md +++ b/demos/SSHRemoting/README.md @@ -46,9 +46,9 @@ In addition you will need to enable password authentication and optionally key b ```none PasswordAuthentication yes ``` - - Add a PowerShell subsystem entry, replace `c:/program files/powershell/6.0.0/powershell.exe` with the correct path to the version you want to use + - Add a PowerShell subsystem entry, replace `c:/program files/powershell/6.0.0/pwsh.exe` with the correct path to the version you want to use ```none - Subsystem powershell c:/program files/powershell/6.0.0/powershell.exe -sshs -NoLogo -NoProfile + Subsystem powershell c:/program files/powershell/6.0.0/pwsh.exe -sshs -NoLogo -NoProfile ``` - Optionally enable key authentication ```none @@ -173,7 +173,7 @@ Microsoft Windows [Version 10.0.10586] # # Windows to Windows # -C:\Users\PSUser\Documents>"C:\Program Files\PowerShell\6.0.0.17\powershell.exe" +C:\Users\PSUser\Documents>pwsh.exe PowerShell Copyright (C) Microsoft Corporation. All rights reserved. diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 62a5692eb66..e9c9f1265da 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -86,7 +86,7 @@ internal sealed partial class ConsoleHost /// /// /// - /// Command line parameters to powershell.exe + /// Command line parameters to pwsh.exe /// /// /// diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs index ff713604d3a..9dc337d0f64 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs @@ -25,7 +25,7 @@ namespace Microsoft.PowerShell { /// /// - /// implementation of RawConsole for powershell.exe + /// implementation of RawConsole for powershell /// /// diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs index 07b579ae8b9..691c8925337 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs @@ -24,7 +24,7 @@ namespace Microsoft.PowerShell /// /// - /// ConsoleHostUserInterface implements console-mode user interface for powershell.exe + /// ConsoleHostUserInterface implements console-mode user interface for powershell /// /// [SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs index 10e6cacfca7..3a9afdf82aa 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterfaceSecurity.cs @@ -13,7 +13,7 @@ namespace Microsoft.PowerShell { /// /// - /// ConsoleHostUserInterface implements console-mode user interface for powershell.exe + /// ConsoleHostUserInterface implements console-mode user interface for powershell /// /// internal partial diff --git a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs index 9f678ec597f..bde0a85e273 100644 --- a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs +++ b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJobDefinition.cs @@ -42,7 +42,7 @@ public sealed class ScheduledJobDefinition : ISerializable, IDisposable private bool _isDisposed; // Task Action strings. - private const string TaskExecutionPath = @"powershell.exe"; + private const string TaskExecutionPath = @"pwsh.exe"; private const string TaskArguments = @"-NoLogo -NonInteractive -WindowStyle Hidden -Command ""Import-Module PSScheduledJob; $jobDef = [Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition]::LoadFromStore('{0}', '{1}'); $jobDef.Run()"""; private static object LockObject = new object(); private static int CurrentId = 0; diff --git a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs index f828906afde..f5ecd6dda8f 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs @@ -503,7 +503,7 @@ public class PowerShellAssemblyLoadContextInitializer /// /// /// This method is to be used by native host whose TPA list doesn't include PS assemblies, such as the - /// in-box Nano powershell.exe, the PS remote WinRM plugin, in-box Nano DSC and in-box Nano SCOM agent. + /// in-box Nano powershell, the PS remote WinRM plugin, in-box Nano DSC and in-box Nano SCOM agent. /// /// /// Base directory paths that are separated by semicolon ';'. diff --git a/src/System.Management.Automation/commands/utility/FormatAndOutput/out-console/OutConsole.cs b/src/System.Management.Automation/commands/utility/FormatAndOutput/out-console/OutConsole.cs index f685c43f369..433176ca86c 100644 --- a/src/System.Management.Automation/commands/utility/FormatAndOutput/out-console/OutConsole.cs +++ b/src/System.Management.Automation/commands/utility/FormatAndOutput/out-console/OutConsole.cs @@ -39,7 +39,7 @@ protected override void ProcessRecord() /// /// implementation for the out-default command /// this command it implicitly inject by the - /// powershell.exe host at the end of the pipeline as the + /// powershell host at the end of the pipeline as the /// default sink (display to console screen) /// [Cmdlet(VerbsData.Out, "Default", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=113362", RemotingCapability = RemotingCapability.None)] diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index f7b2f812098..582f90b5919 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -768,9 +768,9 @@ private static bool NeedToClearProcessModulePath(string currentProcessModulePath private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, string personalModulePath, string sharedModulePath, string psHomeModulePath) { #if UNIX - const string powershellExeName = "powershell"; + const string powershellExeName = "pwsh"; #else - const string powershellExeName = "powershell.exe"; + const string powershellExeName = "pwsh.exe"; #endif StringBuilder modulePathString = new StringBuilder(currentProcessModulePath.Length); char[] invalidPathChars = Path.GetInvalidPathChars(); diff --git a/src/System.Management.Automation/engine/hostifaces/MshHost.cs b/src/System.Management.Automation/engine/hostifaces/MshHost.cs index 484cd1f9008..2256df9c36b 100644 --- a/src/System.Management.Automation/engine/hostifaces/MshHost.cs +++ b/src/System.Management.Automation/engine/hostifaces/MshHost.cs @@ -43,7 +43,7 @@ namespace System.Management.Automation.Host public abstract class PSHost { /// - /// The powershell.exe spec states that 128 is the maximum nesting depth. + /// The powershell spec states that 128 is the maximum nesting depth. /// internal const int MaximumNestedPromptLevel = 128; internal static bool IsStdOutputRedirected; diff --git a/src/System.Management.Automation/engine/hostifaces/PowerShellProcessInstance.cs b/src/System.Management.Automation/engine/hostifaces/PowerShellProcessInstance.cs index f0de5d625a8..77b1e706cf7 100644 --- a/src/System.Management.Automation/engine/hostifaces/PowerShellProcessInstance.cs +++ b/src/System.Management.Automation/engine/hostifaces/PowerShellProcessInstance.cs @@ -38,10 +38,10 @@ static PowerShellProcessInstance() { #if UNIX s_PSExePath = Path.Combine(Utils.DefaultPowerShellAppBase, - "powershell"); + "pwsh"); #else s_PSExePath = Path.Combine(Utils.DefaultPowerShellAppBase, - "powershell.exe"); + "pwsh.exe"); #endif } @@ -79,7 +79,7 @@ public PowerShellProcessInstance(Version powerShellVersion, PSCredential credent #if CORECLR string processArguments = " -s -NoLogo -NoProfile"; #else - // Adding Version parameter to powershell.exe + // Adding Version parameter to powershell // Version parameter needs to go before all other parameters because the native layer looks for Version or // PSConsoleFile parameters before parsing other parameters. // The other parameters get parsed in the managed layer. diff --git a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs index 2616ed72cf3..d454de600f5 100644 --- a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs +++ b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs @@ -2033,11 +2033,11 @@ internal int StartSSHProcess( } #endif - // Create client ssh process that hosts powershell.exe as a subsystem and is configured + // Create client ssh process that hosts powershell as a subsystem and is configured // to be in server mode for PSRP over SSHD: - // powershell -Version 5.1 -sshs -NoLogo -NoProfile + // powershell -sshs -NoLogo -NoProfile // See sshd_configuration file, subsystems section and it will have this entry: - // Subsystem powershell C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 5.1 -sshs -NoLogo -NoProfile + // Subsystem powershell C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -sshs -NoLogo -NoProfile string arguments; if (!string.IsNullOrEmpty(this.KeyFilePath)) { @@ -3166,7 +3166,7 @@ private void CreateContainerProcessInternal() // Windows Server container (i.e., RuntimeId is empty) uses named pipe transport for now. // cmd = string.Format(System.Globalization.CultureInfo.InvariantCulture, - @"{{""CommandLine"": ""powershell.exe {0} -NoLogo {1}"",""RestrictedToken"": {2}}}", + @"{{""CommandLine"": ""pwsh.exe {0} -NoLogo {1}"",""RestrictedToken"": {2}}}", (RuntimeId != Guid.Empty) ? "-so -NoProfile" : "-NamedPipeServerMode", String.IsNullOrEmpty(ConfigurationName) ? String.Empty : String.Concat("-Config ", ConfigurationName), (RunAsAdmin) ? "false" : "true"); diff --git a/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs index e1d8d3a2a5e..b15c38edf35 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs @@ -948,7 +948,7 @@ internal OutOfProcessClientSessionTransportManager(Guid runspaceId, #region Overrides /// - /// Launch a new Process (PowerShell.exe -s) to perform remoting. This is used by *-Job cmdlets + /// Launch a new Process (pwsh -s) to perform remoting. This is used by *-Job cmdlets /// to support background jobs without depending on WinRM (WinRM has complex requirements like /// elevation to support local machine remoting) /// diff --git a/src/powershell-native/Install-PowerShellRemoting.ps1 b/src/powershell-native/Install-PowerShellRemoting.ps1 index 0dd7d6d3f44..dbada625e8a 100644 --- a/src/powershell-native/Install-PowerShellRemoting.ps1 +++ b/src/powershell-native/Install-PowerShellRemoting.ps1 @@ -116,7 +116,7 @@ if (! ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity if ($PsCmdlet.ParameterSetName -eq "ByPath") { $targetPsHome = $PowerShellHome - $targetPsVersion = & "$targetPsHome\powershell" -NoProfile -Command '$PSVersionTable.PSVersion.ToString()' + $targetPsVersion = & "$targetPsHome\pwsh" -NoProfile -Command '$PSVersionTable.PSVersion.ToString()' } else { diff --git a/src/powershell-unix/powershell-unix.csproj b/src/powershell-unix/powershell-unix.csproj index 24834680794..0907317346d 100644 --- a/src/powershell-unix/powershell-unix.csproj +++ b/src/powershell-unix/powershell-unix.csproj @@ -4,7 +4,7 @@ PowerShell top-level project with .NET CLI host - powershell + pwsh Exe linux-x64;osx.10.12-x64; diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index fbf2b11a599..049d0531b6d 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -2,7 +2,7 @@ PowerShell Core on Windows top-level project - powershell + pwsh Exe win7-x86;win7-x64 Microsoft.PowerShell diff --git a/test/docker/networktest/DockerRemoting.Tests.ps1 b/test/docker/networktest/DockerRemoting.Tests.ps1 index 8c8184d843b..06e61b89350 100644 --- a/test/docker/networktest/DockerRemoting.Tests.ps1 +++ b/test/docker/networktest/DockerRemoting.Tests.ps1 @@ -20,7 +20,7 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){ # get fullpath to installed core powershell Write-Verbose -verbose "Getting path to PowerShell core" - $powershellcorepath = docker exec $server powershell -c "(get-childitem 'c:\program files\powershell\*\powershell.exe').fullname" + $powershellcorepath = docker exec $server powershell -c "(get-childitem 'c:\program files\powershell\*\pwsh.exe').fullname" if ( ! $powershellcorepath ) { $pending = $true @@ -40,7 +40,7 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){ # capture the versions of full and core PowerShell write-verbose -verbose "getting powershell full version" $fullVersion = docker exec $client powershell -c "`$psversiontable.psversion.tostring()" - if ( ! $fullVersion ) + if ( ! $fullVersion ) { $pending = $true write-warning "Cannot determine PowerShell full version, not running tests" @@ -49,7 +49,7 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){ write-verbose -verbose "getting powershell core version" $coreVersion = docker exec $client "$powershellcorepath" -c "`$psversiontable.psversion.tostring()" - if ( ! $coreVersion ) + if ( ! $coreVersion ) { $pending = $true write-warning "Cannot determine PowerShell core version, not running tests" diff --git a/test/docker/networktest/Dockerfile b/test/docker/networktest/Dockerfile index e91b3cd443f..1e4f3d65ebb 100644 --- a/test/docker/networktest/Dockerfile +++ b/test/docker/networktest/Dockerfile @@ -1,7 +1,7 @@ # escape=` FROM microsoft/windowsservercore -SHELL ["powershell.exe","-command"] +SHELL ["pwsh.exe","-command"] # the source msi should change on a daily basis # the destination should not change @@ -18,7 +18,7 @@ RUN new-LocalUser -Name testuser -password (ConvertTo-SecureString 11aa!!AA -asp set-item WSMan:/localhost/client/AllowUnencrypted $true; ` Start-Process -FilePath msiexec.exe -ArgumentList '-qn', ` '-i c:\PSCore.msi','-log c:\PSCore-install.log','-norestart' -wait ; ` - $psexec = get-item -path ${ENV:ProgramFiles}/powershell/*/powershell.exe; ` + $psexec = get-item -path ${ENV:ProgramFiles}/powershell/*/pwsh.exe; ` $corehome = $psexec.directory.fullname; ` & $psexec Install-PowerShellRemoting.ps1; ` remove-item -force c:\PSCore.msi diff --git a/test/powershell/Host/Base-Directory.Tests.ps1 b/test/powershell/Host/Base-Directory.Tests.ps1 index eb4f3f4e976..c518cff84df 100644 --- a/test/powershell/Host/Base-Directory.Tests.ps1 +++ b/test/powershell/Host/Base-Directory.Tests.ps1 @@ -1,7 +1,7 @@ Describe "Configuration file locations" -tags "CI","Slow" { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" $profileName = "Microsoft.PowerShell_profile.ps1" } diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 10cf59e92e3..44f7c177963 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -9,7 +9,7 @@ using namespace System.Diagnostics Describe 'minishell for native executables' -Tag 'CI' { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" } Context 'Streams from minishell' { @@ -51,7 +51,7 @@ Describe 'minishell for native executables' -Tag 'CI' { Describe "ConsoleHost unit tests" -tags "Feature" { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" $ExitCodeBadCommandLineParameter = 64 function NewProcessStartInfo([string]$CommandLine, [switch]$RedirectStdIn) @@ -152,7 +152,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" { } foreach ($x in "--help", "-help", "-h", "-?", "--he", "-hel", "--HELP", "-hEl") { It "Accepts '$x' as a parameter for help" { - & $powershell -noprofile $x | Where-Object { $_ -match "PowerShell[.exe] -Help | -? | /?" } | Should Not BeNullOrEmpty + & $powershell -noprofile $x | Where-Object { $_ -match "pwsh[.exe] -Help | -? | /?" } | Should Not BeNullOrEmpty } } @@ -170,7 +170,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" { @{value = "2"}, @{value = "-command 1-1"} ) { - $currentVersion = "powershell " + $PSVersionTable.GitCommitId.ToString() + $currentVersion = "PowerShell " + $PSVersionTable.GitCommitId.ToString() $observed = & $powershell -version $value 2>&1 $observed | should be $currentVersion $LASTEXITCODE | Should Be 0 @@ -487,8 +487,8 @@ foo } Context "PATH environment variable" { - It "`$PSHOME should be in front so that powershell.exe starts current running PowerShell" { - powershell -v | Should Match $psversiontable.GitCommitId + It "`$PSHOME should be in front so that pwsh.exe starts current running PowerShell" { + pwsh -v | Should Match $psversiontable.GitCommitId } It "powershell starts if PATH is not set" -Skip:($IsWindows) { @@ -568,7 +568,7 @@ public enum ShowWindowCommands : int @{WindowStyle="Maximized"} # hidden doesn't work in CI/Server Core ) { param ($WindowStyle) - $ps = Start-Process powershell -ArgumentList "-WindowStyle $WindowStyle -noexit -interactive" -PassThru + $ps = Start-Process pwsh -ArgumentList "-WindowStyle $WindowStyle -noexit -interactive" -PassThru $startTime = Get-Date $showCmd = "Unknown" while (((Get-Date) - $startTime).TotalSeconds -lt 10 -and $showCmd -ne $WindowStyle) @@ -581,7 +581,7 @@ public enum ShowWindowCommands : int } It "Invalid -WindowStyle returns error" { - powershell -WindowStyle invalid + pwsh -WindowStyle invalid $LASTEXITCODE | Should Be $ExitCodeBadCommandLineParameter } } diff --git a/test/powershell/Host/Read-Host.Tests.ps1 b/test/powershell/Host/Read-Host.Tests.ps1 index ca31ed388d4..739c4b85a02 100644 --- a/test/powershell/Host/Read-Host.Tests.ps1 +++ b/test/powershell/Host/Read-Host.Tests.ps1 @@ -1,7 +1,7 @@ Describe "Read-Host" -Tags "Slow","Feature" { Context "[Console]::ReadKey() implementation on non-Windows" { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" $assetsDir = Join-Path -Path $PSScriptRoot -ChildPath assets if ($IsWindows) { $ItArgs = @{ skip = $true } diff --git a/test/powershell/Language/Parser/Conversions.Tests.ps1 b/test/powershell/Language/Parser/Conversions.Tests.ps1 index b568a34fa5b..b8c75704c95 100644 --- a/test/powershell/Language/Parser/Conversions.Tests.ps1 +++ b/test/powershell/Language/Parser/Conversions.Tests.ps1 @@ -114,7 +114,7 @@ namespace TestTypeResolution { Add-Type $cmdletCode -OutputAssembly $cmdletDllPath Add-Type $dupTypeCode -OutputAssembly $dupTypeDllPath - $powershell = Join-Path $PSHOME "powershell" + $powershell = Join-Path $PSHOME "pwsh" } It "validate Type resolution should prefer the assembly loaded by Import-Module" { diff --git a/test/powershell/Language/Parser/UsingAssembly.Tests.ps1 b/test/powershell/Language/Parser/UsingAssembly.Tests.ps1 index 3e303caaeb8..da0b7be0682 100644 --- a/test/powershell/Language/Parser/UsingAssembly.Tests.ps1 +++ b/test/powershell/Language/Parser/UsingAssembly.Tests.ps1 @@ -79,26 +79,26 @@ public class ABC {} } #> It "Assembly loaded at runtime" -pending { - $assemblies = powershell -noprofile -command @" + $assemblies = pwsh -noprofile -command @" using assembly .\UsingAssemblyTest$guid.dll [Appdomain]::CurrentDomain.GetAssemblies().GetName().Name "@ $assemblies -contains "UsingAssemblyTest$guid" | Should Be $true - $assemblies = powershell -noprofile -command @" + $assemblies = pwsh -noprofile -command @" using assembly $PSScriptRoot\UsingAssemblyTest$guid.dll [Appdomain]::CurrentDomain.GetAssemblies().GetName().Name "@ $assemblies -contains "UsingAssemblyTest$guid" | Should Be $true - $assemblies = powershell -noprofile -command @" + $assemblies = pwsh -noprofile -command @" using assembly System.Drawing [Appdomain]::CurrentDomain.GetAssemblies().GetName().Name "@ $assemblies -contains "System.Drawing" | Should Be $true - $assemblies = powershell -noprofile -command @" + $assemblies = pwsh -noprofile -command @" using assembly 'System.Drawing, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [Appdomain]::CurrentDomain.GetAssemblies().GetName().Name "@ diff --git a/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 b/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 index f9dc2880074..987c5416d94 100644 --- a/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 +++ b/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 @@ -1,7 +1,7 @@ Describe 'native commands with pipeline' -tags 'Feature' { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" } It "native | ps | native doesn't block" { @@ -30,8 +30,8 @@ Describe 'native commands with pipeline' -tags 'Feature' { $result = @(ping.exe | findstr.exe count | findstr.exe ping) $result[0] | Should Match "Usage: ping" } else { - $result = @(ps aux | grep powershell | grep -v grep) - $result[0] | Should Match "powershell" + $result = @(ps aux | grep pwsh | grep -v grep) + $result[0] | Should Match "pwsh" } } } diff --git a/test/powershell/Language/Scripting/NativeExecution/NativeStreams.Tests.ps1 b/test/powershell/Language/Scripting/NativeExecution/NativeStreams.Tests.ps1 index 89cb87fc3d4..7ff0bde45a5 100644 --- a/test/powershell/Language/Scripting/NativeExecution/NativeStreams.Tests.ps1 +++ b/test/powershell/Language/Scripting/NativeExecution/NativeStreams.Tests.ps1 @@ -1,5 +1,5 @@ Describe "Native streams behavior with PowerShell" -Tags 'CI' { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" Context "Error stream" { # we are using powershell itself as an example of a native program. diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/Import-Module.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/Import-Module.Tests.ps1 index 911c74c8fae..0821e00d149 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/Import-Module.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/Import-Module.Tests.ps1 @@ -103,7 +103,7 @@ using System.Management.Automation; // Windows PowerShell namespace. namespace ModuleCmdlets { - [Cmdlet(VerbsDiagnostic.Test,"BinaryModuleCmdlet1")] + [Cmdlet(VerbsDiagnostic.Test,"BinaryModuleCmdlet1")] public class TestBinaryModuleCmdlet1Command : Cmdlet { protected override void BeginProcessing() @@ -115,7 +115,7 @@ namespace ModuleCmdlets "@ Add-Type -TypeDefinition $src -OutputAssembly $TESTDRIVE\System.dll - $results = powershell -noprofile -c "`$module = Import-Module $TESTDRIVE\System.dll -Passthru; `$module.ImplementingAssembly.Location; Test-BinaryModuleCmdlet1" + $results = pwsh -noprofile -c "`$module = Import-Module $TESTDRIVE\System.dll -Passthru; `$module.ImplementingAssembly.Location; Test-BinaryModuleCmdlet1" #Ignore slash format difference under windows/Unix $path = (Get-ChildItem $TESTDRIVE\System.dll).FullName diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Default.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Default.Tests.ps1 index 9da136ea0b3..b84fba88204 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Default.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Default.Tests.ps1 @@ -3,7 +3,7 @@ Describe "Out-Default Tests" -tag CI { # due to https://github.com/PowerShell/PowerShell/issues/3405, `Out-Default -Transcript` emits output to pipeline # as running in Pester effectively wraps everything in parenthesis, workaround is to use another powershell # to run the test script passed as a string - $powershell = "$PSHOME/powershell" + $powershell = "$PSHOME/pwsh" } It "'Out-Default -Transcript' shows up in transcript, but not host" { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 index 29b6659922e..32f676d6c91 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 @@ -240,7 +240,7 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { Context "Validate behavior when access is denied" { BeforeAll { - $powershell = Join-Path $PSHOME "powershell" + $powershell = Join-Path $PSHOME "pwsh" if ($IsWindows) { $protectedPath = Join-Path ([environment]::GetFolderPath("windows")) "appcompat" "Programs" diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Service.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Service.Tests.ps1 index 4ef784b11e0..77f3fc62667 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Service.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Service.Tests.ps1 @@ -126,7 +126,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW $creds = [pscredential]::new(".\$startUsername", $password) $parameters = @{ Name = $servicename; - BinaryPathName = "$PSHOME\powershell.exe"; + BinaryPathName = "$PSHOME\pwsh.exe"; StartupType = "Manual"; Credential = $creds } @@ -156,7 +156,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW try { $parameters = @{ Name = $name; - BinaryPathName = "$PSHOME\powershell.exe"; + BinaryPathName = "$PSHOME\pwsh.exe"; StartupType = $startupType; } if ($description) { @@ -200,7 +200,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW $servicename = "testremoveservice" $parameters = @{ Name = $servicename; - BinaryPathName = "$PSHOME\powershell.exe" + BinaryPathName = "$PSHOME\pwsh.exe" } $service = New-Service @parameters $service | Should Not BeNullOrEmpty @@ -218,7 +218,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW $servicename = "testremoveservice" $parameters = @{ Name = $servicename; - BinaryPathName = "$PSHOME\powershell.exe" + BinaryPathName = "$PSHOME\pwsh.exe" } $service = New-Service @parameters $service | Should Not BeNullOrEmpty @@ -241,7 +241,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW $newdisplayname = "newdisplayname" $parameters = @{ Name = $servicename; - BinaryPathName = "$PSHOME\powershell.exe" + BinaryPathName = "$PSHOME\pwsh.exe" } $service = New-Service @parameters $service | Should Not BeNullOrEmpty @@ -260,7 +260,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW $newdisplayname = "newdisplayname" $parameters = @{ Name = $servicename; - BinaryPathName = "$PSHOME\powershell.exe" + BinaryPathName = "$PSHOME\pwsh.exe" } $service = New-Service @parameters $service | Should Not BeNullOrEmpty @@ -290,7 +290,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW param($cmdlet, $name, $parameter, $value, $errorid) $parameters = @{$parameter = $value; Name = $name; ErrorAction = "Stop"} if ($cmdlet -eq "New-Service") { - $parameters += @{Binary = "$PSHOME\powershell.exe"}; + $parameters += @{Binary = "$PSHOME\pwsh.exe"}; } { & $cmdlet @parameters } | ShouldBeErrorId $errorid } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-PSBreakpoint.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-PSBreakpoint.Tests.ps1 index bfc4445d9ff..a9750e92365 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-PSBreakpoint.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-PSBreakpoint.Tests.ps1 @@ -1,4 +1,4 @@ -$ps = Join-Path -Path $PsHome -ChildPath "powershell" +$ps = Join-Path -Path $PsHome -ChildPath "pwsh" Describe "Set-PSBreakpoint DRT Unit Tests" -Tags "CI" { #Set up diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 index e7fa3b1c6ce..a66501ff97b 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 @@ -1,7 +1,7 @@ Describe "Write-Host with default Console Host" -Tags "Slow","Feature" { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" $testData = @( @{ Name = '-Separator'; Command = "Write-Host a,b,c -Separator '+'"; returnCount = 1; returnValue = @("a+b+c") } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/XMLCommand.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/XMLCommand.Tests.ps1 index e5c1de69ca1..83d0ad3c977 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/XMLCommand.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/XMLCommand.Tests.ps1 @@ -102,9 +102,9 @@ Describe "XmlCommand DRT basic functionality Tests" -Tags "CI" { $deserialized_one.two.three.num | Should BeNullOrEmpty } - It "Import-Clixml should work with XML serialization from powershell.exe" { + It "Import-Clixml should work with XML serialization from pwsh.exe" { # need to create separate process so that current powershell doesn't interpret clixml output - Start-Process -FilePath $pshome\powershell -RedirectStandardOutput $testfile -Args "-noprofile -nologo -outputformat xml -command get-command import-clixml" -Wait + Start-Process -FilePath $pshome\pwsh -RedirectStandardOutput $testfile -Args "-noprofile -nologo -outputformat xml -command get-command import-clixml" -Wait $out = Import-Clixml -Path $testfile $out.Name | Should Be "Import-CliXml" $out.CommandType.ToString() | Should Be "Cmdlet" diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/object.tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/object.tests.ps1 index 70a1e16e6c3..e3493397a04 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/object.tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/object.tests.ps1 @@ -2,7 +2,7 @@ Context "Group-Object" { It "AsHashtable returns a hashtable" { $result = Get-Process | Group-Object -Property ProcessName -AsHashTable - $result["powershell"].Count | Should BeGreaterThan 0 + $result["pwsh"].Count | Should BeGreaterThan 0 } It "AsString returns a string" { diff --git a/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 b/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 index 5d6c310aefa..e17dabc8016 100644 --- a/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 @@ -1,7 +1,7 @@ Describe "CredSSP cmdlet tests" -Tags 'Feature','RequireAdminOnWindows' { BeforeAll { - $powershell = Join-Path $PSHOME "powershell" + $powershell = Join-Path $PSHOME "pwsh" $notEnglish = $false $IsToBeSkipped = !$IsWindows; diff --git a/test/powershell/Provider/Pester.AutomountedDrives.Tests.ps1 b/test/powershell/Provider/Pester.AutomountedDrives.Tests.ps1 index add2463864e..af71d73d6b1 100644 --- a/test/powershell/Provider/Pester.AutomountedDrives.Tests.ps1 +++ b/test/powershell/Provider/Pester.AutomountedDrives.Tests.ps1 @@ -1,4 +1,4 @@ -<############################################################################################ +<############################################################################################ # File: Pester.AutomountedDrives.Tests.ps1 # Pester.AutomountedDrives.Tests suite contains Tests that are # used for validating automounted PowerShell drives. @@ -7,8 +7,8 @@ $script:TestSourceRoot = $PSScriptRoot Describe "Test suite for validating automounted PowerShell drives" -Tags @('Feature', 'Slow', 'RequireAdminOnWindows') { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" - + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" + $AutomountVHDDriveScriptPath = Join-Path $script:TestSourceRoot 'AutomountVHDDrive.ps1' $vhdPath = Join-Path $TestDrive 'TestAutomountVHD.vhd' @@ -29,24 +29,24 @@ Describe "Test suite for validating automounted PowerShell drives" -Tags @('Feat catch { $VHDToolsNotFound = $true } } - + Context "Validating automounting FileSystem drives" { - + It "Test automounting using subst.exe" -Skip:$SubstNotFound { & $powershell -noprofile -command "& '$AutomountSubstDriveScriptPath' -FullPath '$substDir'" | Should Be "Drive found" } - + It "Test automounting using New-VHD/Mount-VHD" -Skip:$VHDToolsNotFound { & $powershell -noprofile -command "& '$AutomountVHDDriveScriptPath' -VHDPath '$vhdPath'" | Should Be "Drive found" } } Context "Validating automounting FileSystem drives from modules" { - + It "Test automounting using subst.exe" -Skip:$SubstNotFound { & $powershell -noprofile -command "& '$AutomountSubstDriveScriptPath' -useModule -FullPath '$substDir'" | Should Be "Drive found" } - + It "Test automounting using New-VHD/Mount-VHD" -Skip:$VHDToolsNotFound { $vhdPath = Join-Path $TestDrive 'TestAutomountVHD.vhd' & $powershell -noprofile -command "& '$AutomountVHDDriveScriptPath' -useModule -VHDPath '$vhdPath'" | Should Be "Drive found" diff --git a/test/powershell/README.md b/test/powershell/README.md index 334f511a086..193cb5ac022 100644 --- a/test/powershell/README.md +++ b/test/powershell/README.md @@ -23,7 +23,7 @@ one on the path. Example: ```powershell - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" & $powershell -noprofile -command "ExampleCommand" | Should Be "ExampleOutput" ``` diff --git a/test/powershell/SDK/PSDebugging.Tests.ps1 b/test/powershell/SDK/PSDebugging.Tests.ps1 index f161bcadbfc..2f14eba077d 100644 --- a/test/powershell/SDK/PSDebugging.Tests.ps1 +++ b/test/powershell/SDK/PSDebugging.Tests.ps1 @@ -4,7 +4,7 @@ using namespace System.Management.Automation.Internal Describe "PowerShell Command Debugging" -tags "CI" { BeforeAll { - $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" } function NewProcessStartInfo([string]$CommandLine, [switch]$RedirectStdIn) diff --git a/test/powershell/engine/Job/Jobs.Tests.ps1 b/test/powershell/engine/Job/Jobs.Tests.ps1 index 3303c803a16..eb0ac846548 100644 --- a/test/powershell/engine/Job/Jobs.Tests.ps1 +++ b/test/powershell/engine/Job/Jobs.Tests.ps1 @@ -69,7 +69,7 @@ Describe 'Basic Job Tests' -Tags 'CI' { It "Create job with native command" { try { - $nativeJob = Start-job { powershell -c 1+1 } + $nativeJob = Start-job { pwsh -c 1+1 } $nativeJob | Wait-Job $nativeJob.State | Should BeExactly "Completed" $nativeJob.HasMoreData | Should Be $true diff --git a/test/powershell/engine/Module/ModulePath.Tests.ps1 b/test/powershell/engine/Module/ModulePath.Tests.ps1 index 9d011ff468e..f6fc920e495 100644 --- a/test/powershell/engine/Module/ModulePath.Tests.ps1 +++ b/test/powershell/engine/Module/ModulePath.Tests.ps1 @@ -4,7 +4,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" { if ($IsWindows) { - $powershell = "$PSHOME\powershell.exe" + $powershell = "$PSHOME\pwsh.exe" $ProductName = "WindowsPowerShell" if ($IsCoreCLR -and ($PSHOME -notlike "*Windows\System32\WindowsPowerShell\v1.0")) { @@ -15,7 +15,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" { } else { - $powershell = "$PSHOME/powershell" + $powershell = "$PSHOME/pwsh" $expectedUserPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("USER_MODULES") $expectedSharedPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("SHARED_MODULES") } diff --git a/test/powershell/engine/ParameterBinding/ParameterBinding.Tests.ps1 b/test/powershell/engine/ParameterBinding/ParameterBinding.Tests.ps1 index 591b01f2543..0bf88e86485 100644 --- a/test/powershell/engine/ParameterBinding/ParameterBinding.Tests.ps1 +++ b/test/powershell/engine/ParameterBinding/ParameterBinding.Tests.ps1 @@ -302,7 +302,7 @@ $test2File = Join-Path -Path $tempDir -ChildPath "test2.ps1" $expected = "[$tempDir]" - $psPath = "$PSHOME\powershell" + $psPath = "$PSHOME\pwsh" $null = New-Item -Path $tempDir -ItemType Directory -Force Set-Content -Path $test1File -Value $test1 -Force diff --git a/test/tools/CodeCoverageAutomation/Start-CodeCoverageRun.ps1 b/test/tools/CodeCoverageAutomation/Start-CodeCoverageRun.ps1 index 566e007c8f4..5f231278e11 100644 --- a/test/tools/CodeCoverageAutomation/Start-CodeCoverageRun.ps1 +++ b/test/tools/CodeCoverageAutomation/Start-CodeCoverageRun.ps1 @@ -238,7 +238,7 @@ try } # grab the commitID, we need this to grab the right sources - $gitCommitId = & "$psBinPath\powershell.exe" -noprofile -command { $PSVersiontable.GitCommitId } + $gitCommitId = & "$psBinPath\pwsh.exe" -noprofile -command { $PSVersiontable.GitCommitId } $commitId = $gitCommitId.substring($gitCommitId.LastIndexOf('-g') + 2) # download the src directory diff --git a/test/tools/OpenCover/OpenCover.psm1 b/test/tools/OpenCover/OpenCover.psm1 index 9c765677a86..930be2cea52 100644 --- a/test/tools/OpenCover/OpenCover.psm1 +++ b/test/tools/OpenCover/OpenCover.psm1 @@ -611,7 +611,7 @@ function Install-OpenCover .Synopsis Invoke-OpenCover runs tests under OpenCover to collect code coverage. .Description - Invoke-OpenCover runs tests under OpenCover by executing tests on PowerShell.exe located at $PowerShellExeDirectory. + Invoke-OpenCover runs tests under OpenCover by executing tests on PowerShell located at $PowerShellExeDirectory. .EXAMPLE Invoke-OpenCover -TestPath $pwd/test/powershell -PowerShellExeDirectory $pwd/src/powershell-win-core/bin/CodeCoverage/netcoreapp1.0/win7-x64 #> @@ -654,8 +654,8 @@ function Invoke-OpenCover } } - # check to be sure that powershell.exe is present - $target = "${PowerShellExeDirectory}\powershell.exe" + # check to be sure that pwsh.exe is present + $target = "${PowerShellExeDirectory}\pwsh.exe" if ( ! (test-path $target) ) { throw "$target does not exist, use 'Start-PSBuild -configuration CodeCoverage'" @@ -702,12 +702,12 @@ function Invoke-OpenCover # '&' invoke caused issues with cmdline parameters for opencover.console.exe $elevatedFile = "$env:temp\elevated.ps1" "$OpenCoverBin $cmdlineElevated" | Out-File -FilePath $elevatedFile -force - powershell.exe -file $elevatedFile + pwsh.exe -file $elevatedFile # invoke OpenCover unelevated and poll for completion $unelevatedFile = "$env:temp\unelevated.ps1" "$openCoverBin $cmdlineUnelevated" | Out-File -FilePath $unelevatedFile -Force - runas.exe /trustlevel:0x20000 "powershell.exe -file $unelevatedFile" + runas.exe /trustlevel:0x20000 "pwsh.exe -file $unelevatedFile" # poll for process exit every 60 seconds # timeout of 6 hours # Runs currently take about 2.5 - 3 hours, we picked 6 hours to be substantially larger. From d992c7ba7c8abb465a121317942adb8f9e6cf673 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 13 Oct 2017 15:00:31 -0700 Subject: [PATCH 2/7] [feature] fixed check in appveyor.psm1 --- tools/appveyor.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 58a9ee4025e..359f7c85079 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -323,9 +323,9 @@ function Invoke-AppVeyorTest Write-Host -Foreground Green 'Run CoreCLR tests' $testResultsNonAdminFile = "$pwd\TestsResultsNonAdmin.xml" $testResultsAdminFile = "$pwd\TestsResultsAdmin.xml" - if(!(Test-Path "$env:CoreOutput\powershell.exe")) + if(!(Test-Path "$env:CoreOutput\pwsh.exe")) { - throw "CoreCLR PowerShell.exe was not built" + throw "CoreCLR pwsh.exe was not built" } if(-not (Test-DailyBuild)) From b4daecd2556984b9aaa744ff7a4bd72891f788a2 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 13 Oct 2017 17:24:19 -0700 Subject: [PATCH 3/7] [feature] updated msi to include pwsh in path and app paths reverted change for hyper-v powershell direct reapplied test changes reverted by rebase --- assets/Product.wxs | 16 ++++++++++++++-- .../engine/Modules/ModuleIntrinsics.cs | 5 ++++- .../remoting/common/RunspaceConnectionInfo.cs | 2 +- .../Host/TabCompletion/TabCompletion.Tests.ps1 | 4 ++-- .../clixml.tests.ps1 | 4 ++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/assets/Product.wxs b/assets/Product.wxs index 8f2362d098f..09cab9a6191 100644 --- a/assets/Product.wxs +++ b/assets/Product.wxs @@ -31,7 +31,7 @@ - + @@ -73,6 +73,8 @@ + + @@ -103,13 +105,23 @@ + + + + + + + + + + - diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 582f90b5919..a06ecde2b3a 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -769,8 +769,10 @@ private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, { #if UNIX const string powershellExeName = "pwsh"; + const string oldPowershellExeName = "powershell"; #else const string powershellExeName = "pwsh.exe"; + const string oldPowershellExeName = "powershell.exe"; #endif StringBuilder modulePathString = new StringBuilder(currentProcessModulePath.Length); char[] invalidPathChars = Path.GetInvalidPathChars(); @@ -791,8 +793,9 @@ private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, { string parentDir = Path.GetDirectoryName(trimedPath); string psExePath = Path.Combine(parentDir, powershellExeName); + string oldExePath = Path.Combine(parentDir, oldPowershellExeName); string psDepsPath = Path.Combine(parentDir, "powershell.deps.json"); - if (File.Exists(psExePath) && File.Exists(psDepsPath)) + if ((File.Exists(psExePath) || File.Exists(oldExePath)) && File.Exists(psDepsPath)) { // Path is a PSHome module path from a different powershell core instance. Ignore it. continue; diff --git a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs index d454de600f5..49fb7cb494a 100644 --- a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs +++ b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs @@ -3166,7 +3166,7 @@ private void CreateContainerProcessInternal() // Windows Server container (i.e., RuntimeId is empty) uses named pipe transport for now. // cmd = string.Format(System.Globalization.CultureInfo.InvariantCulture, - @"{{""CommandLine"": ""pwsh.exe {0} -NoLogo {1}"",""RestrictedToken"": {2}}}", + @"{{""CommandLine"": ""powershell.exe {0} -NoLogo {1}"",""RestrictedToken"": {2}}}", (RuntimeId != Guid.Empty) ? "-so -NoProfile" : "-NamedPipeServerMode", String.IsNullOrEmpty(ConfigurationName) ? String.Empty : String.Concat("-Config ", ConfigurationName), (RunAsAdmin) ? "false" : "true"); diff --git a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 index ca77821df86..c416ee22af3 100644 --- a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 +++ b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 @@ -355,7 +355,7 @@ Describe "TabCompletion" -Tags CI { @{ inputStr = '$host.UI.WriteD'; expected = 'WriteDebugLine('; setup = $null } @{ inputStr = '$MaximumHistoryCount.'; expected = 'CompareTo('; setup = $null } @{ inputStr = '$A=[datetime]::now;$A.'; expected = 'Date'; setup = $null } - @{ inputStr = '$x= gps powershell;$x.*pm'; expected = 'NPM'; setup = $null } + @{ inputStr = '$x= gps pwsh;$x.*pm'; expected = 'NPM'; setup = $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Write-Output -a'; expected = '-abcd'; setup = $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Microsoft.PowerShell.Utility\Write-Output -'; expected = '-InputObject'; setup = $null } @{ inputStr = '[math]::Co'; expected = 'Cos('; setup = $null } @@ -418,7 +418,7 @@ Describe "TabCompletion" -Tags CI { @{ inputStr = 'gmo -list PackageM'; expected = 'PackageManagement'; setup = $null } @{ inputStr = 'gcm -Module PackageManagement Find-Pac'; expected = 'Find-Package'; setup = $null } @{ inputStr = 'ipmo PackageM'; expected = 'PackageManagement'; setup = $null } - @{ inputStr = 'Get-Process powersh'; expected = 'powershell'; setup = $null } + @{ inputStr = 'Get-Process pws'; expected = 'pwsh'; setup = $null } @{ inputStr = "function bar { [OutputType('System.IO.FileInfo')][OutputType('System.Diagnostics.Process')]param() }; bar | ? { `$_.ProcessN"; expected = 'ProcessName'; setup = $null } @{ inputStr = "function bar { [OutputType('System.IO.FileInfo')][OutputType('System.Diagnostics.Process')]param() }; bar | ? { `$_.LastAc"; expected = 'LastAccessTime'; setup = $null } @{ inputStr = "& 'get-comm"; expected = "'Get-Command'"; setup = $null } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1 index c81740202b5..c53bced0227 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/clixml.tests.ps1 @@ -37,7 +37,7 @@ Context "Export-CliXml" { BeforeAll { - $gpsList = Get-Process powershell + $gpsList = Get-Process pwsh $gps = $gpsList | Select-Object -First 1 $filePath = Join-Path $subFilePath 'gps.xml' @@ -213,7 +213,7 @@ Describe "Deserializing corrupted Cim classes should not instantiate non-Cim typ It "Verifies that importing the corrupted Cim class does not launch calc.exe" -skip:$skipNotWindows { Import-Clixml -Path (Join-Path $PSScriptRoot "assets\CorruptedCim.clixml") - + # Wait up to 10 seconds for calc.exe to run $calcProc = $null $count = 0 From 422751568aec195dda9d3ebb38d0891b1df334fe Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 16 Oct 2017 15:19:09 -0700 Subject: [PATCH 4/7] [feature] address PR feedback --- assets/Product.wxs | 2 +- .../engine/Modules/ModuleIntrinsics.cs | 8 ++++++-- .../engine/remoting/common/RunspaceConnectionInfo.cs | 2 ++ .../Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/assets/Product.wxs b/assets/Product.wxs index 09cab9a6191..ed98172a4a0 100644 --- a/assets/Product.wxs +++ b/assets/Product.wxs @@ -113,7 +113,7 @@ - + diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index a06ecde2b3a..d5eac5dd9cb 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -774,6 +774,9 @@ private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, const string powershellExeName = "pwsh.exe"; const string oldPowershellExeName = "powershell.exe"; #endif + const string powershellDepsName = "pwsh.deps.json"; + const string oldPowerShellDepsName = "powershell.deps.json"; + StringBuilder modulePathString = new StringBuilder(currentProcessModulePath.Length); char[] invalidPathChars = Path.GetInvalidPathChars(); @@ -794,8 +797,9 @@ private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, string parentDir = Path.GetDirectoryName(trimedPath); string psExePath = Path.Combine(parentDir, powershellExeName); string oldExePath = Path.Combine(parentDir, oldPowershellExeName); - string psDepsPath = Path.Combine(parentDir, "powershell.deps.json"); - if ((File.Exists(psExePath) || File.Exists(oldExePath)) && File.Exists(psDepsPath)) + string psDepsPath = Path.Combine(parentDir, powershellDepsName); + string oldDepsPath = Path.Combine(parentDir, oldPowershellDepsName); + if ((File.Exists(psExePath) && File.Exists(psDepsPath)) || (File.Exists(oldDepsPath) && File.Exists(oldDepsPath))) { // Path is a PSHome module path from a different powershell core instance. Ignore it. continue; diff --git a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs index 49fb7cb494a..ecb94832b0e 100644 --- a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs +++ b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs @@ -3164,6 +3164,8 @@ private void CreateContainerProcessInternal() // // Hyper-V container (i.e., RuntimeId is not empty) uses Hyper-V socket transport. // Windows Server container (i.e., RuntimeId is empty) uses named pipe transport for now. + // This code executes `powershell.exe` as it exists in the container which currently is + // expected to be Windows PowerShell as it's inbox in the container. // cmd = string.Format(System.Globalization.CultureInfo.InvariantCulture, @"{{""CommandLine"": ""powershell.exe {0} -NoLogo {1}"",""RestrictedToken"": {2}}}", diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 index 416b6387e6e..d69cc02d2af 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 @@ -2,7 +2,7 @@ using namespace System.Diagnostics Describe "Invoke-Item basic tests" -Tags "Feature" { BeforeAll { - $powershell = Join-Path $PSHOME -ChildPath powershell + $powershell = Join-Path $PSHOME -ChildPath pwsh $testFile1 = Join-Path -Path $TestDrive -ChildPath "text1.txt" New-Item -Path $testFile1 -ItemType File -Force > $null From 26f92f499eae36012f6d42183c71605af066ada8 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 16 Oct 2017 15:26:59 -0700 Subject: [PATCH 5/7] [feature] missed test generating fake .deps.json file no longer need code in packaging.psm1 to ensure binaries are named correctly (since dotnet does it correctly now) updated symlinks in packaging, didn't update $name value since it appears to be used for the package name which isn't changing --- .../engine/Modules/ModuleIntrinsics.cs | 2 +- .../engine/Module/ModulePath.Tests.ps1 | 6 +-- tools/packaging/packaging.psm1 | 39 +++++-------------- 3 files changed, 13 insertions(+), 34 deletions(-) diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index d5eac5dd9cb..1e151624ab4 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -775,7 +775,7 @@ private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, const string oldPowershellExeName = "powershell.exe"; #endif const string powershellDepsName = "pwsh.deps.json"; - const string oldPowerShellDepsName = "powershell.deps.json"; + const string oldPowershellDepsName = "powershell.deps.json"; StringBuilder modulePathString = new StringBuilder(currentProcessModulePath.Length); char[] invalidPathChars = Path.GetInvalidPathChars(); diff --git a/test/powershell/engine/Module/ModulePath.Tests.ps1 b/test/powershell/engine/Module/ModulePath.Tests.ps1 index f6fc920e495..ade31fa71f8 100644 --- a/test/powershell/engine/Module/ModulePath.Tests.ps1 +++ b/test/powershell/engine/Module/ModulePath.Tests.ps1 @@ -25,7 +25,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" { $fakePSHome = Join-Path -Path $TestDrive -ChildPath 'FakePSHome' $fakePSHomeModuleDir = Join-Path -Path $fakePSHome -ChildPath 'Modules' $fakePowerShell = Join-Path -Path $fakePSHome -ChildPath (Split-Path -Path $powershell -Leaf) - $fakePSDepsFile = Join-Path -Path $fakePSHome -ChildPath "powershell.deps.json" + $fakePSDepsFile = Join-Path -Path $fakePSHome -ChildPath "pwsh.deps.json" New-Item -Path $fakePSHome -ItemType Directory > $null New-Item -Path $fakePSHomeModuleDir -ItemType Directory > $null @@ -56,7 +56,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" { It "ignore pshome module path derived from a different powershell core instance" -Skip:(!$IsCoreCLR) { - ## Create 'powershell' and 'powershell.deps.json' in the fake PSHome folder, + ## Create 'powershell' and 'pwsh.deps.json' in the fake PSHome folder, ## so that the module path calculation logic would believe it's real. New-Item -Path $fakePowerShell -ItemType File -Force > $null New-Item -Path $fakePSDepsFile -ItemType File -Force > $null @@ -75,7 +75,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" { } finally { - ## Remove 'powershell' and 'powershell.deps.json' from the fake PSHome folder + ## Remove 'powershell' and 'pwsh.deps.json' from the fake PSHome folder Remove-Item -Path $fakePowerShell -Force -ErrorAction SilentlyContinue Remove-Item -Path $fakePSDepsFile -Force -ErrorAction SilentlyContinue } diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index bb587e9a12b..b3c50c9512e 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -437,7 +437,7 @@ function New-UnixPackage { # Setup staging directory so we don't change the original source directory $Staging = "$PSScriptRoot/staging" if ($pscmdlet.ShouldProcess("Create staging folder")) { - New-StagingFolder -StagingPath $Staging -Name $Name + New-StagingFolder -StagingPath $Staging } # Follow the Filesystem Hierarchy Standard for Linux and macOS @@ -456,7 +456,7 @@ function New-UnixPackage { if($pscmdlet.ShouldProcess("Create package file system")) { - New-Item -Force -ItemType SymbolicLink -Path "/tmp/$Name" -Target "$Destination/$Name" >$null + New-Item -Force -ItemType SymbolicLink -Path "/tmp/pwsh" -Target "$Destination/$Name" >$null if ($Environment.IsRedHatFamily) { # add two symbolic links to system shared libraries that libmi.so is dependent on to handle @@ -468,14 +468,14 @@ function New-UnixPackage { $AfterInstallScript = [io.path]::GetTempFileName() $AfterRemoveScript = [io.path]::GetTempFileName() - $packagingStrings.RedHatAfterInstallScript -f "$Link/$Name" | Out-File -FilePath $AfterInstallScript -Encoding ascii - $packagingStrings.RedHatAfterRemoveScript -f "$Link/$Name" | Out-File -FilePath $AfterRemoveScript -Encoding ascii + $packagingStrings.RedHatAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii + $packagingStrings.RedHatAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii } elseif ($Environment.IsUbuntu -or $Environment.IsDebian) { $AfterInstallScript = [io.path]::GetTempFileName() $AfterRemoveScript = [io.path]::GetTempFileName() - $packagingStrings.UbuntuAfterInstallScript -f "$Link/$Name" | Out-File -FilePath $AfterInstallScript -Encoding ascii - $packagingStrings.UbuntuAfterRemoveScript -f "$Link/$Name" | Out-File -FilePath $AfterRemoveScript -Encoding ascii + $packagingStrings.UbuntuAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii + $packagingStrings.UbuntuAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii } @@ -584,7 +584,7 @@ function New-UnixPackage { $Arguments += @( "$Staging/=$Destination/", "$GzipFile=$ManFile", - "/tmp/$Name=$Link" + "/tmp/pwsh=$Link" ) # Build package try { @@ -639,32 +639,11 @@ function New-StagingFolder param( [Parameter(Mandatory)] [string] - $StagingPath, - - # Must start with 'powershell' but may have any suffix - [Parameter(Mandatory)] - [ValidatePattern("^powershell")] - [string] - $Name + $StagingPath ) Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $StagingPath Copy-Item -Recurse $PackageSourcePath $StagingPath - - # Rename files to given name if not "powershell" - if ($Name -ne "powershell") { - $Files = @("powershell", - "powershell.dll", - "powershell.deps.json", - "powershell.pdb", - "powershell.runtimeconfig.json", - "powershell.xml") - - foreach ($File in $Files) { - $NewName = $File -replace "^powershell", $Name - Move-Item "$StagingPath/$File" "$StagingPath/$NewName" - } - } } # Function to create a zip file for Nano Server and xcopy deployment @@ -790,7 +769,7 @@ function New-NugetPackage $stagingRoot = New-SubFolder -Path $PSScriptRoot -ChildPath 'nugetStaging' -Clean $contentFolder = Join-Path -path $stagingRoot -ChildPath 'content' if ($pscmdlet.ShouldProcess("Create staging folder")) { - New-StagingFolder -StagingPath $contentFolder -Name $Name + New-StagingFolder -StagingPath $contentFolder } $projectFolder = Join-Path $PSScriptRoot -ChildPath 'project' From a5e72408c13512b8733ad277e3d4c19d8ddfe40c Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 17 Oct 2017 15:30:30 -0700 Subject: [PATCH 6/7] Some more updates to packaging.psm1 --- tools/packaging/packaging.psm1 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index b3c50c9512e..9f9ad26ac61 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -456,7 +456,7 @@ function New-UnixPackage { if($pscmdlet.ShouldProcess("Create package file system")) { - New-Item -Force -ItemType SymbolicLink -Path "/tmp/pwsh" -Target "$Destination/$Name" >$null + New-Item -Force -ItemType SymbolicLink -Path "/tmp/pwsh" -Target "$Destination/pwsh" >$null if ($Environment.IsRedHatFamily) { # add two symbolic links to system shared libraries that libmi.so is dependent on to handle @@ -483,7 +483,7 @@ function New-UnixPackage { # if the target of the powershell symlink exists, `fpm` aborts # with a `utime` error on macOS. # so we move it to make symlink broken - $symlink_dest = "$Destination/$Name" + $symlink_dest = "$Destination/pwsh" $hack_dest = "./_fpm_symlink_hack_powershell" if ($Environment.IsMacOS) { if (Test-Path $symlink_dest) { @@ -501,10 +501,8 @@ function New-UnixPackage { Start-NativeExecution { ronn --roff $RonnFile } # Setup for side-by-side man pages (noop if primary package) - $FixedRoffFile = $RoffFile -replace "powershell.1$", "$Name.1" - if ($Name -ne "powershell") { - Move-Item $RoffFile $FixedRoffFile - } + $FixedRoffFile = $RoffFile -replace "powershell.1$", "pwsh.1" + Move-Item $RoffFile $FixedRoffFile # gzip in assets directory $GzipFile = "$FixedRoffFile.gz" @@ -517,7 +515,7 @@ function New-UnixPackage { find $Staging -type d | xargs chmod 755 find $Staging -type f | xargs chmod 644 chmod 644 $GzipFile - chmod 755 "$Staging/$Name" # only the executable should be executable + chmod 755 "$Staging/pwsh" # only the executable should be executable } } @@ -576,10 +574,10 @@ function New-UnixPackage { $Arguments += @("--depends", $Dependency) } if ($AfterInstallScript) { - $Arguments += @("--after-install", $AfterInstallScript) + $Arguments += @("--after-install", $AfterInstallScript) } if ($AfterRemoveScript) { - $Arguments += @("--after-remove", $AfterRemoveScript) + $Arguments += @("--after-remove", $AfterRemoveScript) } $Arguments += @( "$Staging/=$Destination/", @@ -600,11 +598,12 @@ function New-UnixPackage { } } if ($AfterInstallScript) { - Remove-Item -erroraction 'silentlycontinue' $AfterInstallScript + Remove-Item -erroraction 'silentlycontinue' $AfterInstallScript } if ($AfterRemoveScript) { - Remove-Item -erroraction 'silentlycontinue' $AfterRemoveScript + Remove-Item -erroraction 'silentlycontinue' $AfterRemoveScript } + Remove-Item -Path $GzipFile -Force -ErrorAction SilentlyContinue } # Magic to get path output From b41e048aeae6a691d3d8c7ea5b6620e105aac4bc Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 17 Oct 2017 15:57:47 -0700 Subject: [PATCH 7/7] [feature] fix check for SxS --- .../engine/Modules/ModuleIntrinsics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 1e151624ab4..88b716b655b 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -799,7 +799,7 @@ private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, string oldExePath = Path.Combine(parentDir, oldPowershellExeName); string psDepsPath = Path.Combine(parentDir, powershellDepsName); string oldDepsPath = Path.Combine(parentDir, oldPowershellDepsName); - if ((File.Exists(psExePath) && File.Exists(psDepsPath)) || (File.Exists(oldDepsPath) && File.Exists(oldDepsPath))) + if ((File.Exists(psExePath) && File.Exists(psDepsPath)) || (File.Exists(oldExePath) && File.Exists(oldDepsPath))) { // Path is a PSHome module path from a different powershell core instance. Ignore it. continue;