Rename powershell.exe to pwsh.exe (#5101)
- Rename powershell.exe to pwsh.exe - Fixe appveyor.psm1 - Update MSI to include 'pwsh' in path and app paths - Revert change for hyper-v powershell direct - Update names in packaging.psm1. - Fix check for SxS
This commit is contained in:
parent
17731cf6e9
commit
2cc091115b
@ -147,6 +147,7 @@ psobjects
|
|||||||
psproxyjobs
|
psproxyjobs
|
||||||
PSReadline
|
PSReadline
|
||||||
PSSessionConfiguration
|
PSSessionConfiguration
|
||||||
|
pwsh
|
||||||
redistributables
|
redistributables
|
||||||
Register-EngineEvent
|
Register-EngineEvent
|
||||||
Register-PSSessionConfiguration
|
Register-PSSessionConfiguration
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<WixVariable Id="WixUIInfoIco" Value="assets\WixUIInfoIco.bmp" />
|
<WixVariable Id="WixUIInfoIco" Value="assets\WixUIInfoIco.bmp" />
|
||||||
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Open $(env.ProductName)" />
|
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Open $(env.ProductName)" />
|
||||||
<!-- Default value of Checkbox of starting PowerShell after installation -->
|
<!-- Default value of Checkbox of starting PowerShell after installation -->
|
||||||
<Property Id="WixShellExecTarget" Value="[$(var.ProductVersionWithName)]PowerShell.exe"/>
|
<Property Id="WixShellExecTarget" Value="[$(var.ProductVersionWithName)]pwsh.exe"/>
|
||||||
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
|
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
|
||||||
<UI>
|
<UI>
|
||||||
<Dialog Id="MyExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
|
<Dialog Id="MyExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
|
||||||
@ -73,6 +73,8 @@
|
|||||||
<ComponentGroupRef Id="$(var.ProductVersionWithName)"/>
|
<ComponentGroupRef Id="$(var.ProductVersionWithName)"/>
|
||||||
<ComponentRef Id="ProductVersionFolder"/>
|
<ComponentRef Id="ProductVersionFolder"/>
|
||||||
<ComponentRef Id="ApplicationProgramsMenuShortcut"/>
|
<ComponentRef Id="ApplicationProgramsMenuShortcut"/>
|
||||||
|
<ComponentRef Id="RegistryEntries"/>
|
||||||
|
<ComponentRef Id="SetPath"/>
|
||||||
</Feature>
|
</Feature>
|
||||||
<!-- We need to show EULA, and provide option to customize download location -->
|
<!-- We need to show EULA, and provide option to customize download location -->
|
||||||
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
|
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
|
||||||
@ -103,13 +105,23 @@
|
|||||||
<Component Id="ProductVersionFolder" Guid="{e1a7f05e-0cd6-4227-80a8-e4fb311f045c}">
|
<Component Id="ProductVersionFolder" Guid="{e1a7f05e-0cd6-4227-80a8-e4fb311f045c}">
|
||||||
<CreateFolder/>
|
<CreateFolder/>
|
||||||
</Component>
|
</Component>
|
||||||
|
<!-- register ourselves in application registry so can be started using just Win+R `pwsh.exe` -->
|
||||||
|
<Component Id="RegistryEntries" Guid="{402e52f7-baf8-489d-af21-f756a6ca3530}">
|
||||||
|
<RegistryKey Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pwsh.exe" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
|
||||||
|
<RegistryValue Type="string" Value="[$(var.ProductVersionWithName)]pwsh.exe"/>
|
||||||
|
</RegistryKey>
|
||||||
|
</Component>
|
||||||
|
<!-- add ourselvs to %PATH% so pwsh.exe can be started from Windows PowerShell or cmd.exe -->
|
||||||
|
<Component Id="SetPath" Guid="{9dbb7763-7baf-48e7-b025-3bdedcb0632f}">
|
||||||
|
<Environment Id="PATH" Action="set" Name="PATH" Part="last" Permanent="no" System="yes" Value="[$(var.ProductVersionWithName)]"/>
|
||||||
|
</Component>
|
||||||
</Directory>
|
</Directory>
|
||||||
</Directory>
|
</Directory>
|
||||||
</Directory>
|
</Directory>
|
||||||
<Directory Id="ProgramMenuFolder">
|
<Directory Id="ProgramMenuFolder">
|
||||||
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductSemanticVersionWithName)">
|
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductSemanticVersionWithName)">
|
||||||
<Component Id="ApplicationProgramsMenuShortcut" Guid="{A77507A7-F970-4618-AC30-20AFE36EE2EB}">
|
<Component Id="ApplicationProgramsMenuShortcut" Guid="{A77507A7-F970-4618-AC30-20AFE36EE2EB}">
|
||||||
<Shortcut Id="PowerShell_ProgramsMenuShortcut" Name="$(var.ProductSemanticVersionWithName)" Description="$(var.ProductSemanticVersionWithName)" Target="[$(var.ProductVersionWithName)]PowerShell.exe" WorkingDirectory="$(var.ProductVersionWithName)"
|
<Shortcut Id="PowerShell_ProgramsMenuShortcut" Name="$(var.ProductSemanticVersionWithName)" Description="$(var.ProductSemanticVersionWithName)" Target="[$(var.ProductVersionWithName)]pwsh.exe" WorkingDirectory="$(var.ProductVersionWithName)"
|
||||||
Icon = "PowerShellExe.ico" />
|
Icon = "PowerShellExe.ico" />
|
||||||
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
||||||
<RegistryValue Root="HKCU" Key="Software\Microsoft\$(var.ProductSemanticVersionWithName)\ProgramsMenuShortcut" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
<RegistryValue Root="HKCU" Key="Software\Microsoft\$(var.ProductSemanticVersionWithName)\ProgramsMenuShortcut" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||||
|
12
build.psm1
12
build.psm1
@ -187,7 +187,7 @@ function Start-BuildNativeWindowsBinaries {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# cmake is needed to build powershell.exe
|
# cmake is needed to build pwsh.exe
|
||||||
if (-not (precheck 'cmake' $null)) {
|
if (-not (precheck 'cmake' $null)) {
|
||||||
throw 'cmake not found. Run "Start-PSBootstrap -BuildWindowsNative". You can also install it from https://chocolatey.org/packages/cmake'
|
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
|
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
|
$publishPath = Split-Path $Options.Output -Parent
|
||||||
try {
|
try {
|
||||||
# Relative paths do not work well if cwd is not changed to project
|
# Relative paths do not work well if cwd is not changed to project
|
||||||
@ -507,7 +507,7 @@ Fix steps:
|
|||||||
|
|
||||||
if ($CrossGen) {
|
if ($CrossGen) {
|
||||||
Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime
|
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 {
|
} else {
|
||||||
log "PowerShell output: $($Options.Output)"
|
log "PowerShell output: $($Options.Output)"
|
||||||
}
|
}
|
||||||
@ -680,9 +680,9 @@ function New-PSOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$Executable = if ($Environment.IsLinux -or $Environment.IsMacOS) {
|
$Executable = if ($Environment.IsLinux -or $Environment.IsMacOS) {
|
||||||
"powershell"
|
"pwsh"
|
||||||
} elseif ($Environment.IsWindows) {
|
} elseif ($Environment.IsWindows) {
|
||||||
"powershell.exe"
|
"pwsh.exe"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build the Output path
|
# Build the Output path
|
||||||
@ -837,7 +837,7 @@ function Start-PSPester {
|
|||||||
[string[]]$Path = @("$PSScriptRoot/test/common","$PSScriptRoot/test/powershell"),
|
[string[]]$Path = @("$PSScriptRoot/test/common","$PSScriptRoot/test/powershell"),
|
||||||
[switch]$ThrowOnFailure,
|
[switch]$ThrowOnFailure,
|
||||||
[string]$binDir = (Split-Path (New-PSOptions).Output),
|
[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")),
|
[string]$Pester = ([IO.Path]::Combine($binDir, "Modules", "Pester")),
|
||||||
[Parameter(ParameterSetName='Unelevate',Mandatory=$true)]
|
[Parameter(ParameterSetName='Unelevate',Mandatory=$true)]
|
||||||
[switch]$Unelevate,
|
[switch]$Unelevate,
|
||||||
|
@ -72,7 +72,7 @@ cp shared/Microsoft.NetCore.App/2.1.0-preview1-25719-04/* ~/powershell
|
|||||||
## Start PowerShell
|
## Start PowerShell
|
||||||
|
|
||||||
```bash
|
```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.
|
Note that until arm32 is [fully supported by CoreCLR](https://github.com/dotnet/coreclr/issues/3977), it's not supported by PowerShell Core.
|
||||||
|
@ -46,9 +46,9 @@ In addition you will need to enable password authentication and optionally key b
|
|||||||
```none
|
```none
|
||||||
PasswordAuthentication yes
|
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
|
```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
|
- Optionally enable key authentication
|
||||||
```none
|
```none
|
||||||
@ -173,7 +173,7 @@ Microsoft Windows [Version 10.0.10586]
|
|||||||
#
|
#
|
||||||
# Windows to Windows
|
# Windows to Windows
|
||||||
#
|
#
|
||||||
C:\Users\PSUser\Documents>"C:\Program Files\PowerShell\6.0.0.17\powershell.exe"
|
C:\Users\PSUser\Documents>pwsh.exe
|
||||||
PowerShell
|
PowerShell
|
||||||
Copyright (C) Microsoft Corporation. All rights reserved.
|
Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ namespace Microsoft.PowerShell
|
|||||||
/// </param>
|
/// </param>
|
||||||
/// <param name = "args">
|
/// <param name = "args">
|
||||||
///
|
///
|
||||||
/// Command line parameters to powershell.exe
|
/// Command line parameters to pwsh.exe
|
||||||
///
|
///
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
|
@ -25,7 +25,7 @@ namespace Microsoft.PowerShell
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// implementation of RawConsole for powershell.exe
|
/// implementation of RawConsole for powershell
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace Microsoft.PowerShell
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// ConsoleHostUserInterface implements console-mode user interface for powershell.exe
|
/// ConsoleHostUserInterface implements console-mode user interface for powershell
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
|
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
|
||||||
|
@ -13,7 +13,7 @@ namespace Microsoft.PowerShell
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// ConsoleHostUserInterface implements console-mode user interface for powershell.exe
|
/// ConsoleHostUserInterface implements console-mode user interface for powershell
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal partial
|
internal partial
|
||||||
|
@ -42,7 +42,7 @@ namespace Microsoft.PowerShell.ScheduledJob
|
|||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
|
|
||||||
// Task Action strings.
|
// 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 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 object LockObject = new object();
|
||||||
private static int CurrentId = 0;
|
private static int CurrentId = 0;
|
||||||
|
@ -503,7 +503,7 @@ namespace System.Management.Automation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method is to be used by native host whose TPA list doesn't include PS assemblies, such as the
|
/// 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.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="basePaths">
|
/// <param name="basePaths">
|
||||||
/// Base directory paths that are separated by semicolon ';'.
|
/// Base directory paths that are separated by semicolon ';'.
|
||||||
|
@ -39,7 +39,7 @@ namespace Microsoft.PowerShell.Commands
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// implementation for the out-default command
|
/// implementation for the out-default command
|
||||||
/// this command it implicitly inject by the
|
/// 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)
|
/// default sink (display to console screen)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Cmdlet(VerbsData.Out, "Default", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=113362", RemotingCapability = RemotingCapability.None)]
|
[Cmdlet(VerbsData.Out, "Default", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=113362", RemotingCapability = RemotingCapability.None)]
|
||||||
|
@ -768,10 +768,15 @@ namespace System.Management.Automation
|
|||||||
private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, string personalModulePath, string sharedModulePath, string psHomeModulePath)
|
private static string RemoveSxSPsHomeModulePath(string currentProcessModulePath, string personalModulePath, string sharedModulePath, string psHomeModulePath)
|
||||||
{
|
{
|
||||||
#if UNIX
|
#if UNIX
|
||||||
const string powershellExeName = "powershell";
|
const string powershellExeName = "pwsh";
|
||||||
|
const string oldPowershellExeName = "powershell";
|
||||||
#else
|
#else
|
||||||
const string powershellExeName = "powershell.exe";
|
const string powershellExeName = "pwsh.exe";
|
||||||
|
const string oldPowershellExeName = "powershell.exe";
|
||||||
#endif
|
#endif
|
||||||
|
const string powershellDepsName = "pwsh.deps.json";
|
||||||
|
const string oldPowershellDepsName = "powershell.deps.json";
|
||||||
|
|
||||||
StringBuilder modulePathString = new StringBuilder(currentProcessModulePath.Length);
|
StringBuilder modulePathString = new StringBuilder(currentProcessModulePath.Length);
|
||||||
char[] invalidPathChars = Path.GetInvalidPathChars();
|
char[] invalidPathChars = Path.GetInvalidPathChars();
|
||||||
|
|
||||||
@ -791,8 +796,10 @@ namespace System.Management.Automation
|
|||||||
{
|
{
|
||||||
string parentDir = Path.GetDirectoryName(trimedPath);
|
string parentDir = Path.GetDirectoryName(trimedPath);
|
||||||
string psExePath = Path.Combine(parentDir, powershellExeName);
|
string psExePath = Path.Combine(parentDir, powershellExeName);
|
||||||
string psDepsPath = Path.Combine(parentDir, "powershell.deps.json");
|
string oldExePath = Path.Combine(parentDir, oldPowershellExeName);
|
||||||
if (File.Exists(psExePath) && File.Exists(psDepsPath))
|
string psDepsPath = Path.Combine(parentDir, powershellDepsName);
|
||||||
|
string oldDepsPath = Path.Combine(parentDir, oldPowershellDepsName);
|
||||||
|
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.
|
// Path is a PSHome module path from a different powershell core instance. Ignore it.
|
||||||
continue;
|
continue;
|
||||||
|
@ -43,7 +43,7 @@ namespace System.Management.Automation.Host
|
|||||||
public abstract class PSHost
|
public abstract class PSHost
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The powershell.exe spec states that 128 is the maximum nesting depth.
|
/// The powershell spec states that 128 is the maximum nesting depth.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal const int MaximumNestedPromptLevel = 128;
|
internal const int MaximumNestedPromptLevel = 128;
|
||||||
internal static bool IsStdOutputRedirected;
|
internal static bool IsStdOutputRedirected;
|
||||||
|
@ -38,10 +38,10 @@ namespace System.Management.Automation.Runspaces
|
|||||||
{
|
{
|
||||||
#if UNIX
|
#if UNIX
|
||||||
s_PSExePath = Path.Combine(Utils.DefaultPowerShellAppBase,
|
s_PSExePath = Path.Combine(Utils.DefaultPowerShellAppBase,
|
||||||
"powershell");
|
"pwsh");
|
||||||
#else
|
#else
|
||||||
s_PSExePath = Path.Combine(Utils.DefaultPowerShellAppBase,
|
s_PSExePath = Path.Combine(Utils.DefaultPowerShellAppBase,
|
||||||
"powershell.exe");
|
"pwsh.exe");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace System.Management.Automation.Runspaces
|
|||||||
#if CORECLR
|
#if CORECLR
|
||||||
string processArguments = " -s -NoLogo -NoProfile";
|
string processArguments = " -s -NoLogo -NoProfile";
|
||||||
#else
|
#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
|
// Version parameter needs to go before all other parameters because the native layer looks for Version or
|
||||||
// PSConsoleFile parameters before parsing other parameters.
|
// PSConsoleFile parameters before parsing other parameters.
|
||||||
// The other parameters get parsed in the managed layer.
|
// The other parameters get parsed in the managed layer.
|
||||||
|
@ -2033,11 +2033,11 @@ namespace System.Management.Automation.Runspaces
|
|||||||
}
|
}
|
||||||
#endif
|
#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:
|
// 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:
|
// 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;
|
string arguments;
|
||||||
if (!string.IsNullOrEmpty(this.KeyFilePath))
|
if (!string.IsNullOrEmpty(this.KeyFilePath))
|
||||||
{
|
{
|
||||||
@ -3164,6 +3164,8 @@ namespace System.Management.Automation.Runspaces
|
|||||||
//
|
//
|
||||||
// Hyper-V container (i.e., RuntimeId is not empty) uses Hyper-V socket transport.
|
// 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.
|
// 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,
|
cmd = string.Format(System.Globalization.CultureInfo.InvariantCulture,
|
||||||
@"{{""CommandLine"": ""powershell.exe {0} -NoLogo {1}"",""RestrictedToken"": {2}}}",
|
@"{{""CommandLine"": ""powershell.exe {0} -NoLogo {1}"",""RestrictedToken"": {2}}}",
|
||||||
|
@ -948,7 +948,7 @@ namespace System.Management.Automation.Remoting.Client
|
|||||||
#region Overrides
|
#region Overrides
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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
|
/// to support background jobs without depending on WinRM (WinRM has complex requirements like
|
||||||
/// elevation to support local machine remoting)
|
/// elevation to support local machine remoting)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -116,7 +116,7 @@ if (! ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity
|
|||||||
if ($PsCmdlet.ParameterSetName -eq "ByPath")
|
if ($PsCmdlet.ParameterSetName -eq "ByPath")
|
||||||
{
|
{
|
||||||
$targetPsHome = $PowerShellHome
|
$targetPsHome = $PowerShellHome
|
||||||
$targetPsVersion = & "$targetPsHome\powershell" -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
|
$targetPsVersion = & "$targetPsHome\pwsh" -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>PowerShell top-level project with .NET CLI host</Description>
|
<Description>PowerShell top-level project with .NET CLI host</Description>
|
||||||
<AssemblyName>powershell</AssemblyName>
|
<AssemblyName>pwsh</AssemblyName>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifiers>linux-x64;osx.10.12-x64;</RuntimeIdentifiers>
|
<RuntimeIdentifiers>linux-x64;osx.10.12-x64;</RuntimeIdentifiers>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\..\PowerShell.Common.props" />
|
<Import Project="..\..\PowerShell.Common.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>PowerShell Core on Windows top-level project</Description>
|
<Description>PowerShell Core on Windows top-level project</Description>
|
||||||
<AssemblyName>powershell</AssemblyName>
|
<AssemblyName>pwsh</AssemblyName>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
|
||||||
<RootNamespace>Microsoft.PowerShell</RootNamespace>
|
<RootNamespace>Microsoft.PowerShell</RootNamespace>
|
||||||
|
@ -20,7 +20,7 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){
|
|||||||
|
|
||||||
# get fullpath to installed core powershell
|
# get fullpath to installed core powershell
|
||||||
Write-Verbose -verbose "Getting path to PowerShell core"
|
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 )
|
if ( ! $powershellcorepath )
|
||||||
{
|
{
|
||||||
$pending = $true
|
$pending = $true
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM microsoft/windowsservercore
|
FROM microsoft/windowsservercore
|
||||||
|
|
||||||
SHELL ["powershell.exe","-command"]
|
SHELL ["pwsh.exe","-command"]
|
||||||
|
|
||||||
# the source msi should change on a daily basis
|
# the source msi should change on a daily basis
|
||||||
# the destination should not change
|
# 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; `
|
set-item WSMan:/localhost/client/AllowUnencrypted $true; `
|
||||||
Start-Process -FilePath msiexec.exe -ArgumentList '-qn', `
|
Start-Process -FilePath msiexec.exe -ArgumentList '-qn', `
|
||||||
'-i c:\PSCore.msi','-log c:\PSCore-install.log','-norestart' -wait ; `
|
'-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; `
|
$corehome = $psexec.directory.fullname; `
|
||||||
& $psexec Install-PowerShellRemoting.ps1; `
|
& $psexec Install-PowerShellRemoting.ps1; `
|
||||||
remove-item -force c:\PSCore.msi
|
remove-item -force c:\PSCore.msi
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Describe "Configuration file locations" -tags "CI","Slow" {
|
Describe "Configuration file locations" -tags "CI","Slow" {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
$profileName = "Microsoft.PowerShell_profile.ps1"
|
$profileName = "Microsoft.PowerShell_profile.ps1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ using namespace System.Diagnostics
|
|||||||
Describe 'minishell for native executables' -Tag 'CI' {
|
Describe 'minishell for native executables' -Tag 'CI' {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
}
|
}
|
||||||
|
|
||||||
Context 'Streams from minishell' {
|
Context 'Streams from minishell' {
|
||||||
@ -51,7 +51,7 @@ Describe 'minishell for native executables' -Tag 'CI' {
|
|||||||
Describe "ConsoleHost unit tests" -tags "Feature" {
|
Describe "ConsoleHost unit tests" -tags "Feature" {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
$ExitCodeBadCommandLineParameter = 64
|
$ExitCodeBadCommandLineParameter = 64
|
||||||
|
|
||||||
function NewProcessStartInfo([string]$CommandLine, [switch]$RedirectStdIn)
|
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") {
|
foreach ($x in "--help", "-help", "-h", "-?", "--he", "-hel", "--HELP", "-hEl") {
|
||||||
It "Accepts '$x' as a parameter for help" {
|
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 = "2"},
|
||||||
@{value = "-command 1-1"}
|
@{value = "-command 1-1"}
|
||||||
) {
|
) {
|
||||||
$currentVersion = "powershell " + $PSVersionTable.GitCommitId.ToString()
|
$currentVersion = "PowerShell " + $PSVersionTable.GitCommitId.ToString()
|
||||||
$observed = & $powershell -version $value 2>&1
|
$observed = & $powershell -version $value 2>&1
|
||||||
$observed | should be $currentVersion
|
$observed | should be $currentVersion
|
||||||
$LASTEXITCODE | Should Be 0
|
$LASTEXITCODE | Should Be 0
|
||||||
@ -487,8 +487,8 @@ foo
|
|||||||
}
|
}
|
||||||
|
|
||||||
Context "PATH environment variable" {
|
Context "PATH environment variable" {
|
||||||
It "`$PSHOME should be in front so that powershell.exe starts current running PowerShell" {
|
It "`$PSHOME should be in front so that pwsh.exe starts current running PowerShell" {
|
||||||
powershell -v | Should Match $psversiontable.GitCommitId
|
pwsh -v | Should Match $psversiontable.GitCommitId
|
||||||
}
|
}
|
||||||
|
|
||||||
It "powershell starts if PATH is not set" -Skip:($IsWindows) {
|
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
|
@{WindowStyle="Maximized"} # hidden doesn't work in CI/Server Core
|
||||||
) {
|
) {
|
||||||
param ($WindowStyle)
|
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
|
$startTime = Get-Date
|
||||||
$showCmd = "Unknown"
|
$showCmd = "Unknown"
|
||||||
while (((Get-Date) - $startTime).TotalSeconds -lt 10 -and $showCmd -ne $WindowStyle)
|
while (((Get-Date) - $startTime).TotalSeconds -lt 10 -and $showCmd -ne $WindowStyle)
|
||||||
@ -581,7 +581,7 @@ public enum ShowWindowCommands : int
|
|||||||
}
|
}
|
||||||
|
|
||||||
It "Invalid -WindowStyle returns error" {
|
It "Invalid -WindowStyle returns error" {
|
||||||
powershell -WindowStyle invalid
|
pwsh -WindowStyle invalid
|
||||||
$LASTEXITCODE | Should Be $ExitCodeBadCommandLineParameter
|
$LASTEXITCODE | Should Be $ExitCodeBadCommandLineParameter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Describe "Read-Host" -Tags "Slow","Feature" {
|
Describe "Read-Host" -Tags "Slow","Feature" {
|
||||||
Context "[Console]::ReadKey() implementation on non-Windows" {
|
Context "[Console]::ReadKey() implementation on non-Windows" {
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
$assetsDir = Join-Path -Path $PSScriptRoot -ChildPath assets
|
$assetsDir = Join-Path -Path $PSScriptRoot -ChildPath assets
|
||||||
if ($IsWindows) {
|
if ($IsWindows) {
|
||||||
$ItArgs = @{ skip = $true }
|
$ItArgs = @{ skip = $true }
|
||||||
|
@ -355,7 +355,7 @@ Describe "TabCompletion" -Tags CI {
|
|||||||
@{ inputStr = '$host.UI.WriteD'; expected = 'WriteDebugLine('; setup = $null }
|
@{ inputStr = '$host.UI.WriteD'; expected = 'WriteDebugLine('; setup = $null }
|
||||||
@{ inputStr = '$MaximumHistoryCount.'; expected = 'CompareTo('; setup = $null }
|
@{ inputStr = '$MaximumHistoryCount.'; expected = 'CompareTo('; setup = $null }
|
||||||
@{ inputStr = '$A=[datetime]::now;$A.'; expected = 'Date'; 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};Write-Output -a'; expected = '-abcd'; setup = $null }
|
||||||
@{ inputStr = 'function write-output {param($abcd) $abcd};Microsoft.PowerShell.Utility\Write-Output -'; expected = '-InputObject'; 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 }
|
@{ inputStr = '[math]::Co'; expected = 'Cos('; setup = $null }
|
||||||
@ -418,7 +418,7 @@ Describe "TabCompletion" -Tags CI {
|
|||||||
@{ inputStr = 'gmo -list PackageM'; expected = 'PackageManagement'; setup = $null }
|
@{ inputStr = 'gmo -list PackageM'; expected = 'PackageManagement'; setup = $null }
|
||||||
@{ inputStr = 'gcm -Module PackageManagement Find-Pac'; expected = 'Find-Package'; setup = $null }
|
@{ inputStr = 'gcm -Module PackageManagement Find-Pac'; expected = 'Find-Package'; setup = $null }
|
||||||
@{ inputStr = 'ipmo PackageM'; expected = 'PackageManagement'; 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 | ? { `$_.ProcessN"; expected = 'ProcessName'; setup = $null }
|
||||||
@{ inputStr = "function bar { [OutputType('System.IO.FileInfo')][OutputType('System.Diagnostics.Process')]param() }; bar | ? { `$_.LastAc"; expected = 'LastAccessTime'; 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 }
|
@{ inputStr = "& 'get-comm"; expected = "'Get-Command'"; setup = $null }
|
||||||
|
@ -114,7 +114,7 @@ namespace TestTypeResolution {
|
|||||||
Add-Type $cmdletCode -OutputAssembly $cmdletDllPath
|
Add-Type $cmdletCode -OutputAssembly $cmdletDllPath
|
||||||
Add-Type $dupTypeCode -OutputAssembly $dupTypeDllPath
|
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" {
|
It "validate Type resolution should prefer the assembly loaded by Import-Module" {
|
||||||
|
@ -79,26 +79,26 @@ public class ABC {}
|
|||||||
}
|
}
|
||||||
#>
|
#>
|
||||||
It "Assembly loaded at runtime" -pending {
|
It "Assembly loaded at runtime" -pending {
|
||||||
$assemblies = powershell -noprofile -command @"
|
$assemblies = pwsh -noprofile -command @"
|
||||||
using assembly .\UsingAssemblyTest$guid.dll
|
using assembly .\UsingAssemblyTest$guid.dll
|
||||||
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
||||||
"@
|
"@
|
||||||
$assemblies -contains "UsingAssemblyTest$guid" | Should Be $true
|
$assemblies -contains "UsingAssemblyTest$guid" | Should Be $true
|
||||||
|
|
||||||
$assemblies = powershell -noprofile -command @"
|
$assemblies = pwsh -noprofile -command @"
|
||||||
using assembly $PSScriptRoot\UsingAssemblyTest$guid.dll
|
using assembly $PSScriptRoot\UsingAssemblyTest$guid.dll
|
||||||
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
||||||
"@
|
"@
|
||||||
$assemblies -contains "UsingAssemblyTest$guid" | Should Be $true
|
$assemblies -contains "UsingAssemblyTest$guid" | Should Be $true
|
||||||
|
|
||||||
|
|
||||||
$assemblies = powershell -noprofile -command @"
|
$assemblies = pwsh -noprofile -command @"
|
||||||
using assembly System.Drawing
|
using assembly System.Drawing
|
||||||
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
||||||
"@
|
"@
|
||||||
$assemblies -contains "System.Drawing" | Should Be $true
|
$assemblies -contains "System.Drawing" | Should Be $true
|
||||||
|
|
||||||
$assemblies = powershell -noprofile -command @"
|
$assemblies = pwsh -noprofile -command @"
|
||||||
using assembly 'System.Drawing, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
|
using assembly 'System.Drawing, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
|
||||||
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
[Appdomain]::CurrentDomain.GetAssemblies().GetName().Name
|
||||||
"@
|
"@
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Describe 'native commands with pipeline' -tags 'Feature' {
|
Describe 'native commands with pipeline' -tags 'Feature' {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
}
|
}
|
||||||
|
|
||||||
It "native | ps | native doesn't block" {
|
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 = @(ping.exe | findstr.exe count | findstr.exe ping)
|
||||||
$result[0] | Should Match "Usage: ping"
|
$result[0] | Should Match "Usage: ping"
|
||||||
} else {
|
} else {
|
||||||
$result = @(ps aux | grep powershell | grep -v grep)
|
$result = @(ps aux | grep pwsh | grep -v grep)
|
||||||
$result[0] | Should Match "powershell"
|
$result[0] | Should Match "pwsh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Describe "Native streams behavior with PowerShell" -Tags 'CI' {
|
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" {
|
Context "Error stream" {
|
||||||
# we are using powershell itself as an example of a native program.
|
# we are using powershell itself as an example of a native program.
|
||||||
|
@ -115,7 +115,7 @@ namespace ModuleCmdlets
|
|||||||
"@
|
"@
|
||||||
|
|
||||||
Add-Type -TypeDefinition $src -OutputAssembly $TESTDRIVE\System.dll
|
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
|
#Ignore slash format difference under windows/Unix
|
||||||
$path = (Get-ChildItem $TESTDRIVE\System.dll).FullName
|
$path = (Get-ChildItem $TESTDRIVE\System.dll).FullName
|
||||||
|
@ -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
|
# 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
|
# as running in Pester effectively wraps everything in parenthesis, workaround is to use another powershell
|
||||||
# to run the test script passed as a string
|
# 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" {
|
It "'Out-Default -Transcript' shows up in transcript, but not host" {
|
||||||
|
@ -240,7 +240,7 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" {
|
|||||||
|
|
||||||
Context "Validate behavior when access is denied" {
|
Context "Validate behavior when access is denied" {
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path $PSHOME "powershell"
|
$powershell = Join-Path $PSHOME "pwsh"
|
||||||
if ($IsWindows)
|
if ($IsWindows)
|
||||||
{
|
{
|
||||||
$protectedPath = Join-Path ([environment]::GetFolderPath("windows")) "appcompat" "Programs"
|
$protectedPath = Join-Path ([environment]::GetFolderPath("windows")) "appcompat" "Programs"
|
||||||
|
@ -126,7 +126,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW
|
|||||||
$creds = [pscredential]::new(".\$startUsername", $password)
|
$creds = [pscredential]::new(".\$startUsername", $password)
|
||||||
$parameters = @{
|
$parameters = @{
|
||||||
Name = $servicename;
|
Name = $servicename;
|
||||||
BinaryPathName = "$PSHOME\powershell.exe";
|
BinaryPathName = "$PSHOME\pwsh.exe";
|
||||||
StartupType = "Manual";
|
StartupType = "Manual";
|
||||||
Credential = $creds
|
Credential = $creds
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW
|
|||||||
try {
|
try {
|
||||||
$parameters = @{
|
$parameters = @{
|
||||||
Name = $name;
|
Name = $name;
|
||||||
BinaryPathName = "$PSHOME\powershell.exe";
|
BinaryPathName = "$PSHOME\pwsh.exe";
|
||||||
StartupType = $startupType;
|
StartupType = $startupType;
|
||||||
}
|
}
|
||||||
if ($description) {
|
if ($description) {
|
||||||
@ -200,7 +200,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW
|
|||||||
$servicename = "testremoveservice"
|
$servicename = "testremoveservice"
|
||||||
$parameters = @{
|
$parameters = @{
|
||||||
Name = $servicename;
|
Name = $servicename;
|
||||||
BinaryPathName = "$PSHOME\powershell.exe"
|
BinaryPathName = "$PSHOME\pwsh.exe"
|
||||||
}
|
}
|
||||||
$service = New-Service @parameters
|
$service = New-Service @parameters
|
||||||
$service | Should Not BeNullOrEmpty
|
$service | Should Not BeNullOrEmpty
|
||||||
@ -218,7 +218,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW
|
|||||||
$servicename = "testremoveservice"
|
$servicename = "testremoveservice"
|
||||||
$parameters = @{
|
$parameters = @{
|
||||||
Name = $servicename;
|
Name = $servicename;
|
||||||
BinaryPathName = "$PSHOME\powershell.exe"
|
BinaryPathName = "$PSHOME\pwsh.exe"
|
||||||
}
|
}
|
||||||
$service = New-Service @parameters
|
$service = New-Service @parameters
|
||||||
$service | Should Not BeNullOrEmpty
|
$service | Should Not BeNullOrEmpty
|
||||||
@ -241,7 +241,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW
|
|||||||
$newdisplayname = "newdisplayname"
|
$newdisplayname = "newdisplayname"
|
||||||
$parameters = @{
|
$parameters = @{
|
||||||
Name = $servicename;
|
Name = $servicename;
|
||||||
BinaryPathName = "$PSHOME\powershell.exe"
|
BinaryPathName = "$PSHOME\pwsh.exe"
|
||||||
}
|
}
|
||||||
$service = New-Service @parameters
|
$service = New-Service @parameters
|
||||||
$service | Should Not BeNullOrEmpty
|
$service | Should Not BeNullOrEmpty
|
||||||
@ -260,7 +260,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW
|
|||||||
$newdisplayname = "newdisplayname"
|
$newdisplayname = "newdisplayname"
|
||||||
$parameters = @{
|
$parameters = @{
|
||||||
Name = $servicename;
|
Name = $servicename;
|
||||||
BinaryPathName = "$PSHOME\powershell.exe"
|
BinaryPathName = "$PSHOME\pwsh.exe"
|
||||||
}
|
}
|
||||||
$service = New-Service @parameters
|
$service = New-Service @parameters
|
||||||
$service | Should Not BeNullOrEmpty
|
$service | Should Not BeNullOrEmpty
|
||||||
@ -290,7 +290,7 @@ Describe "Set/New/Remove-Service cmdlet tests" -Tags "Feature", "RequireAdminOnW
|
|||||||
param($cmdlet, $name, $parameter, $value, $errorid)
|
param($cmdlet, $name, $parameter, $value, $errorid)
|
||||||
$parameters = @{$parameter = $value; Name = $name; ErrorAction = "Stop"}
|
$parameters = @{$parameter = $value; Name = $name; ErrorAction = "Stop"}
|
||||||
if ($cmdlet -eq "New-Service") {
|
if ($cmdlet -eq "New-Service") {
|
||||||
$parameters += @{Binary = "$PSHOME\powershell.exe"};
|
$parameters += @{Binary = "$PSHOME\pwsh.exe"};
|
||||||
}
|
}
|
||||||
{ & $cmdlet @parameters } | ShouldBeErrorId $errorid
|
{ & $cmdlet @parameters } | ShouldBeErrorId $errorid
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ using namespace System.Diagnostics
|
|||||||
|
|
||||||
Describe "Invoke-Item basic tests" -Tags "Feature" {
|
Describe "Invoke-Item basic tests" -Tags "Feature" {
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path $PSHOME -ChildPath powershell
|
$powershell = Join-Path $PSHOME -ChildPath pwsh
|
||||||
|
|
||||||
$testFile1 = Join-Path -Path $TestDrive -ChildPath "text1.txt"
|
$testFile1 = Join-Path -Path $TestDrive -ChildPath "text1.txt"
|
||||||
New-Item -Path $testFile1 -ItemType File -Force > $null
|
New-Item -Path $testFile1 -ItemType File -Force > $null
|
||||||
|
@ -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" {
|
Describe "Set-PSBreakpoint DRT Unit Tests" -Tags "CI" {
|
||||||
#Set up
|
#Set up
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Describe "Write-Host with default Console Host" -Tags "Slow","Feature" {
|
Describe "Write-Host with default Console Host" -Tags "Slow","Feature" {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
|
|
||||||
$testData = @(
|
$testData = @(
|
||||||
@{ Name = '-Separator'; Command = "Write-Host a,b,c -Separator '+'"; returnCount = 1; returnValue = @("a+b+c") }
|
@{ Name = '-Separator'; Command = "Write-Host a,b,c -Separator '+'"; returnCount = 1; returnValue = @("a+b+c") }
|
||||||
|
@ -102,9 +102,9 @@ Describe "XmlCommand DRT basic functionality Tests" -Tags "CI" {
|
|||||||
$deserialized_one.two.three.num | Should BeNullOrEmpty
|
$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
|
# 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 = Import-Clixml -Path $testfile
|
||||||
$out.Name | Should Be "Import-CliXml"
|
$out.Name | Should Be "Import-CliXml"
|
||||||
$out.CommandType.ToString() | Should Be "Cmdlet"
|
$out.CommandType.ToString() | Should Be "Cmdlet"
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
Context "Export-CliXml" {
|
Context "Export-CliXml" {
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$gpsList = Get-Process powershell
|
$gpsList = Get-Process pwsh
|
||||||
$gps = $gpsList | Select-Object -First 1
|
$gps = $gpsList | Select-Object -First 1
|
||||||
$filePath = Join-Path $subFilePath 'gps.xml'
|
$filePath = Join-Path $subFilePath 'gps.xml'
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Context "Group-Object" {
|
Context "Group-Object" {
|
||||||
It "AsHashtable returns a hashtable" {
|
It "AsHashtable returns a hashtable" {
|
||||||
$result = Get-Process | Group-Object -Property ProcessName -AsHashTable
|
$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" {
|
It "AsString returns a string" {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Describe "CredSSP cmdlet tests" -Tags 'Feature','RequireAdminOnWindows' {
|
Describe "CredSSP cmdlet tests" -Tags 'Feature','RequireAdminOnWindows' {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path $PSHOME "powershell"
|
$powershell = Join-Path $PSHOME "pwsh"
|
||||||
$notEnglish = $false
|
$notEnglish = $false
|
||||||
$IsToBeSkipped = !$IsWindows;
|
$IsToBeSkipped = !$IsWindows;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ $script:TestSourceRoot = $PSScriptRoot
|
|||||||
Describe "Test suite for validating automounted PowerShell drives" -Tags @('Feature', 'Slow', 'RequireAdminOnWindows') {
|
Describe "Test suite for validating automounted PowerShell drives" -Tags @('Feature', 'Slow', 'RequireAdminOnWindows') {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
|
|
||||||
$AutomountVHDDriveScriptPath = Join-Path $script:TestSourceRoot 'AutomountVHDDrive.ps1'
|
$AutomountVHDDriveScriptPath = Join-Path $script:TestSourceRoot 'AutomountVHDDrive.ps1'
|
||||||
$vhdPath = Join-Path $TestDrive 'TestAutomountVHD.vhd'
|
$vhdPath = Join-Path $TestDrive 'TestAutomountVHD.vhd'
|
||||||
|
@ -23,7 +23,7 @@ one on the path.
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
& $powershell -noprofile -command "ExampleCommand" | Should Be "ExampleOutput"
|
& $powershell -noprofile -command "ExampleCommand" | Should Be "ExampleOutput"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ using namespace System.Management.Automation.Internal
|
|||||||
Describe "PowerShell Command Debugging" -tags "CI" {
|
Describe "PowerShell Command Debugging" -tags "CI" {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
|
||||||
}
|
}
|
||||||
|
|
||||||
function NewProcessStartInfo([string]$CommandLine, [switch]$RedirectStdIn)
|
function NewProcessStartInfo([string]$CommandLine, [switch]$RedirectStdIn)
|
||||||
|
@ -69,7 +69,7 @@ Describe 'Basic Job Tests' -Tags 'CI' {
|
|||||||
|
|
||||||
It "Create job with native command" {
|
It "Create job with native command" {
|
||||||
try {
|
try {
|
||||||
$nativeJob = Start-job { powershell -c 1+1 }
|
$nativeJob = Start-job { pwsh -c 1+1 }
|
||||||
$nativeJob | Wait-Job
|
$nativeJob | Wait-Job
|
||||||
$nativeJob.State | Should BeExactly "Completed"
|
$nativeJob.State | Should BeExactly "Completed"
|
||||||
$nativeJob.HasMoreData | Should Be $true
|
$nativeJob.HasMoreData | Should Be $true
|
||||||
|
@ -4,7 +4,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" {
|
|||||||
|
|
||||||
if ($IsWindows)
|
if ($IsWindows)
|
||||||
{
|
{
|
||||||
$powershell = "$PSHOME\powershell.exe"
|
$powershell = "$PSHOME\pwsh.exe"
|
||||||
$ProductName = "WindowsPowerShell"
|
$ProductName = "WindowsPowerShell"
|
||||||
if ($IsCoreCLR -and ($PSHOME -notlike "*Windows\System32\WindowsPowerShell\v1.0"))
|
if ($IsCoreCLR -and ($PSHOME -notlike "*Windows\System32\WindowsPowerShell\v1.0"))
|
||||||
{
|
{
|
||||||
@ -15,7 +15,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$powershell = "$PSHOME/powershell"
|
$powershell = "$PSHOME/pwsh"
|
||||||
$expectedUserPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("USER_MODULES")
|
$expectedUserPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("USER_MODULES")
|
||||||
$expectedSharedPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("SHARED_MODULES")
|
$expectedSharedPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory("SHARED_MODULES")
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ Describe "SxS Module Path Basic Tests" -tags "CI" {
|
|||||||
$fakePSHome = Join-Path -Path $TestDrive -ChildPath 'FakePSHome'
|
$fakePSHome = Join-Path -Path $TestDrive -ChildPath 'FakePSHome'
|
||||||
$fakePSHomeModuleDir = Join-Path -Path $fakePSHome -ChildPath 'Modules'
|
$fakePSHomeModuleDir = Join-Path -Path $fakePSHome -ChildPath 'Modules'
|
||||||
$fakePowerShell = Join-Path -Path $fakePSHome -ChildPath (Split-Path -Path $powershell -Leaf)
|
$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 $fakePSHome -ItemType Directory > $null
|
||||||
New-Item -Path $fakePSHomeModuleDir -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) {
|
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.
|
## so that the module path calculation logic would believe it's real.
|
||||||
New-Item -Path $fakePowerShell -ItemType File -Force > $null
|
New-Item -Path $fakePowerShell -ItemType File -Force > $null
|
||||||
New-Item -Path $fakePSDepsFile -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 {
|
} 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 $fakePowerShell -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item -Path $fakePSDepsFile -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $fakePSDepsFile -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@
|
|||||||
$test2File = Join-Path -Path $tempDir -ChildPath "test2.ps1"
|
$test2File = Join-Path -Path $tempDir -ChildPath "test2.ps1"
|
||||||
|
|
||||||
$expected = "[$tempDir]"
|
$expected = "[$tempDir]"
|
||||||
$psPath = "$PSHOME\powershell"
|
$psPath = "$PSHOME\pwsh"
|
||||||
|
|
||||||
$null = New-Item -Path $tempDir -ItemType Directory -Force
|
$null = New-Item -Path $tempDir -ItemType Directory -Force
|
||||||
Set-Content -Path $test1File -Value $test1 -Force
|
Set-Content -Path $test1File -Value $test1 -Force
|
||||||
|
@ -238,7 +238,7 @@ try
|
|||||||
}
|
}
|
||||||
|
|
||||||
# grab the commitID, we need this to grab the right sources
|
# 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)
|
$commitId = $gitCommitId.substring($gitCommitId.LastIndexOf('-g') + 2)
|
||||||
|
|
||||||
# download the src directory
|
# download the src directory
|
||||||
|
@ -611,7 +611,7 @@ function Install-OpenCover
|
|||||||
.Synopsis
|
.Synopsis
|
||||||
Invoke-OpenCover runs tests under OpenCover to collect code coverage.
|
Invoke-OpenCover runs tests under OpenCover to collect code coverage.
|
||||||
.Description
|
.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
|
.EXAMPLE
|
||||||
Invoke-OpenCover -TestPath $pwd/test/powershell -PowerShellExeDirectory $pwd/src/powershell-win-core/bin/CodeCoverage/netcoreapp1.0/win7-x64
|
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
|
# check to be sure that pwsh.exe is present
|
||||||
$target = "${PowerShellExeDirectory}\powershell.exe"
|
$target = "${PowerShellExeDirectory}\pwsh.exe"
|
||||||
if ( ! (test-path $target) )
|
if ( ! (test-path $target) )
|
||||||
{
|
{
|
||||||
throw "$target does not exist, use 'Start-PSBuild -configuration CodeCoverage'"
|
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
|
# '&' invoke caused issues with cmdline parameters for opencover.console.exe
|
||||||
$elevatedFile = "$env:temp\elevated.ps1"
|
$elevatedFile = "$env:temp\elevated.ps1"
|
||||||
"$OpenCoverBin $cmdlineElevated" | Out-File -FilePath $elevatedFile -force
|
"$OpenCoverBin $cmdlineElevated" | Out-File -FilePath $elevatedFile -force
|
||||||
powershell.exe -file $elevatedFile
|
pwsh.exe -file $elevatedFile
|
||||||
|
|
||||||
# invoke OpenCover unelevated and poll for completion
|
# invoke OpenCover unelevated and poll for completion
|
||||||
$unelevatedFile = "$env:temp\unelevated.ps1"
|
$unelevatedFile = "$env:temp\unelevated.ps1"
|
||||||
"$openCoverBin $cmdlineUnelevated" | Out-File -FilePath $unelevatedFile -Force
|
"$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
|
# poll for process exit every 60 seconds
|
||||||
# timeout of 6 hours
|
# timeout of 6 hours
|
||||||
# Runs currently take about 2.5 - 3 hours, we picked 6 hours to be substantially larger.
|
# Runs currently take about 2.5 - 3 hours, we picked 6 hours to be substantially larger.
|
||||||
|
@ -323,9 +323,9 @@ function Invoke-AppVeyorTest
|
|||||||
Write-Host -Foreground Green 'Run CoreCLR tests'
|
Write-Host -Foreground Green 'Run CoreCLR tests'
|
||||||
$testResultsNonAdminFile = "$pwd\TestsResultsNonAdmin.xml"
|
$testResultsNonAdminFile = "$pwd\TestsResultsNonAdmin.xml"
|
||||||
$testResultsAdminFile = "$pwd\TestsResultsAdmin.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))
|
if(-not (Test-DailyBuild))
|
||||||
|
@ -437,7 +437,7 @@ function New-UnixPackage {
|
|||||||
# Setup staging directory so we don't change the original source directory
|
# Setup staging directory so we don't change the original source directory
|
||||||
$Staging = "$PSScriptRoot/staging"
|
$Staging = "$PSScriptRoot/staging"
|
||||||
if ($pscmdlet.ShouldProcess("Create staging folder")) {
|
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
|
# Follow the Filesystem Hierarchy Standard for Linux and macOS
|
||||||
@ -456,7 +456,7 @@ function New-UnixPackage {
|
|||||||
|
|
||||||
if($pscmdlet.ShouldProcess("Create package file system"))
|
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/pwsh" >$null
|
||||||
|
|
||||||
if ($Environment.IsRedHatFamily) {
|
if ($Environment.IsRedHatFamily) {
|
||||||
# add two symbolic links to system shared libraries that libmi.so is dependent on to handle
|
# 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()
|
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||||
$AfterRemoveScript = [io.path]::GetTempFileName()
|
$AfterRemoveScript = [io.path]::GetTempFileName()
|
||||||
$packagingStrings.RedHatAfterInstallScript -f "$Link/$Name" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
$packagingStrings.RedHatAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||||
$packagingStrings.RedHatAfterRemoveScript -f "$Link/$Name" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
$packagingStrings.RedHatAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||||
}
|
}
|
||||||
elseif ($Environment.IsUbuntu -or $Environment.IsDebian) {
|
elseif ($Environment.IsUbuntu -or $Environment.IsDebian) {
|
||||||
$AfterInstallScript = [io.path]::GetTempFileName()
|
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||||
$AfterRemoveScript = [io.path]::GetTempFileName()
|
$AfterRemoveScript = [io.path]::GetTempFileName()
|
||||||
$packagingStrings.UbuntuAfterInstallScript -f "$Link/$Name" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
$packagingStrings.UbuntuAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||||
$packagingStrings.UbuntuAfterRemoveScript -f "$Link/$Name" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
$packagingStrings.UbuntuAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ function New-UnixPackage {
|
|||||||
# if the target of the powershell symlink exists, `fpm` aborts
|
# if the target of the powershell symlink exists, `fpm` aborts
|
||||||
# with a `utime` error on macOS.
|
# with a `utime` error on macOS.
|
||||||
# so we move it to make symlink broken
|
# so we move it to make symlink broken
|
||||||
$symlink_dest = "$Destination/$Name"
|
$symlink_dest = "$Destination/pwsh"
|
||||||
$hack_dest = "./_fpm_symlink_hack_powershell"
|
$hack_dest = "./_fpm_symlink_hack_powershell"
|
||||||
if ($Environment.IsMacOS) {
|
if ($Environment.IsMacOS) {
|
||||||
if (Test-Path $symlink_dest) {
|
if (Test-Path $symlink_dest) {
|
||||||
@ -501,10 +501,8 @@ function New-UnixPackage {
|
|||||||
Start-NativeExecution { ronn --roff $RonnFile }
|
Start-NativeExecution { ronn --roff $RonnFile }
|
||||||
|
|
||||||
# Setup for side-by-side man pages (noop if primary package)
|
# Setup for side-by-side man pages (noop if primary package)
|
||||||
$FixedRoffFile = $RoffFile -replace "powershell.1$", "$Name.1"
|
$FixedRoffFile = $RoffFile -replace "powershell.1$", "pwsh.1"
|
||||||
if ($Name -ne "powershell") {
|
Move-Item $RoffFile $FixedRoffFile
|
||||||
Move-Item $RoffFile $FixedRoffFile
|
|
||||||
}
|
|
||||||
|
|
||||||
# gzip in assets directory
|
# gzip in assets directory
|
||||||
$GzipFile = "$FixedRoffFile.gz"
|
$GzipFile = "$FixedRoffFile.gz"
|
||||||
@ -517,7 +515,7 @@ function New-UnixPackage {
|
|||||||
find $Staging -type d | xargs chmod 755
|
find $Staging -type d | xargs chmod 755
|
||||||
find $Staging -type f | xargs chmod 644
|
find $Staging -type f | xargs chmod 644
|
||||||
chmod 644 $GzipFile
|
chmod 644 $GzipFile
|
||||||
chmod 755 "$Staging/$Name" # only the executable should be executable
|
chmod 755 "$Staging/pwsh" # only the executable should be executable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,15 +574,15 @@ function New-UnixPackage {
|
|||||||
$Arguments += @("--depends", $Dependency)
|
$Arguments += @("--depends", $Dependency)
|
||||||
}
|
}
|
||||||
if ($AfterInstallScript) {
|
if ($AfterInstallScript) {
|
||||||
$Arguments += @("--after-install", $AfterInstallScript)
|
$Arguments += @("--after-install", $AfterInstallScript)
|
||||||
}
|
}
|
||||||
if ($AfterRemoveScript) {
|
if ($AfterRemoveScript) {
|
||||||
$Arguments += @("--after-remove", $AfterRemoveScript)
|
$Arguments += @("--after-remove", $AfterRemoveScript)
|
||||||
}
|
}
|
||||||
$Arguments += @(
|
$Arguments += @(
|
||||||
"$Staging/=$Destination/",
|
"$Staging/=$Destination/",
|
||||||
"$GzipFile=$ManFile",
|
"$GzipFile=$ManFile",
|
||||||
"/tmp/$Name=$Link"
|
"/tmp/pwsh=$Link"
|
||||||
)
|
)
|
||||||
# Build package
|
# Build package
|
||||||
try {
|
try {
|
||||||
@ -600,11 +598,12 @@ function New-UnixPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($AfterInstallScript) {
|
if ($AfterInstallScript) {
|
||||||
Remove-Item -erroraction 'silentlycontinue' $AfterInstallScript
|
Remove-Item -erroraction 'silentlycontinue' $AfterInstallScript
|
||||||
}
|
}
|
||||||
if ($AfterRemoveScript) {
|
if ($AfterRemoveScript) {
|
||||||
Remove-Item -erroraction 'silentlycontinue' $AfterRemoveScript
|
Remove-Item -erroraction 'silentlycontinue' $AfterRemoveScript
|
||||||
}
|
}
|
||||||
|
Remove-Item -Path $GzipFile -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
# Magic to get path output
|
# Magic to get path output
|
||||||
@ -639,32 +638,11 @@ function New-StagingFolder
|
|||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[string]
|
[string]
|
||||||
$StagingPath,
|
$StagingPath
|
||||||
|
|
||||||
# Must start with 'powershell' but may have any suffix
|
|
||||||
[Parameter(Mandatory)]
|
|
||||||
[ValidatePattern("^powershell")]
|
|
||||||
[string]
|
|
||||||
$Name
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $StagingPath
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $StagingPath
|
||||||
Copy-Item -Recurse $PackageSourcePath $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
|
# Function to create a zip file for Nano Server and xcopy deployment
|
||||||
@ -790,7 +768,7 @@ function New-NugetPackage
|
|||||||
$stagingRoot = New-SubFolder -Path $PSScriptRoot -ChildPath 'nugetStaging' -Clean
|
$stagingRoot = New-SubFolder -Path $PSScriptRoot -ChildPath 'nugetStaging' -Clean
|
||||||
$contentFolder = Join-Path -path $stagingRoot -ChildPath 'content'
|
$contentFolder = Join-Path -path $stagingRoot -ChildPath 'content'
|
||||||
if ($pscmdlet.ShouldProcess("Create staging folder")) {
|
if ($pscmdlet.ShouldProcess("Create staging folder")) {
|
||||||
New-StagingFolder -StagingPath $contentFolder -Name $Name
|
New-StagingFolder -StagingPath $contentFolder
|
||||||
}
|
}
|
||||||
|
|
||||||
$projectFolder = Join-Path $PSScriptRoot -ChildPath 'project'
|
$projectFolder = Join-Path $PSScriptRoot -ChildPath 'project'
|
||||||
|
Loading…
Reference in New Issue
Block a user