mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Invoke-Item and Get-Help -Online are unsupported on Nano
These currently fail at runtime on Nano, and will continue to do so. But this implements these much needed cmdlets for Open PowerShell. If there is a way to determine that PowerShell is being run on the Nano OS at runtime, then we could instead throw a platform unsupported exception, but this cannot be based on the target compilation framework, as .NET Core is shared for both Nano and Windows.
This commit is contained in:
@@ -704,8 +704,20 @@ namespace Microsoft.PowerShell.Commands
|
||||
|
||||
if (Platform.IsWindows)
|
||||
{
|
||||
// this is a re-implementation of the unavailable (on .NET Core) UseShellExecute,
|
||||
// where we manually execute a cmd.exe shell, and use its start command to
|
||||
// launch the default application for the given path
|
||||
browserProcess.StartInfo.FileName = "cmd.exe";
|
||||
browserProcess.StartInfo.Arguments = string.Format(@"/c ""start /b """" {0}""", uriToLaunch.OriginalString);
|
||||
|
||||
// start is very picky: the "optional" TITLE as the first argument should always
|
||||
// be included, otherwise it can silently fail
|
||||
browserProcess.StartInfo.Arguments = string.Format(CultureInfo.InvariantCulture,
|
||||
@"/c ""start /b """" {0}""", uriToLaunch.OriginalString);
|
||||
|
||||
// please note that there is currently no way to differentiate between running
|
||||
// on Nano as an OS and having targeted the .NET Core framework, thus this code
|
||||
// will continue to fail on Nano (as there is no browser), but at least is
|
||||
// implemented for .NET Core PowerShell on Windows
|
||||
}
|
||||
else if (Platform.IsOSX)
|
||||
{
|
||||
|
||||
@@ -1337,9 +1337,20 @@ namespace Microsoft.PowerShell.Commands
|
||||
|
||||
if (Platform.IsWindows)
|
||||
{
|
||||
// this is a re-implementation of the unavailable (on .NET Core) UseShellExecute,
|
||||
// where we manually execute a cmd.exe shell, and use its start command to
|
||||
// launch the default application for the given path
|
||||
invokeProcess.StartInfo.FileName = "cmd.exe";
|
||||
// start is very picky: the "optional" TITLE as the first argument should always be included, otherwise it can silently fail
|
||||
invokeProcess.StartInfo.Arguments = string.Format(@"/c ""start /b """" ""{0}""""", path);
|
||||
|
||||
// start is very picky: the "optional" TITLE as the first argument should always
|
||||
// be included, otherwise it can silently fail
|
||||
invokeProcess.StartInfo.Arguments = string.Format(CultureInfo.InvariantCulture,
|
||||
@"/c ""start /b """" ""{0}""""", path);
|
||||
|
||||
// please note that there is currently no way to differentiate between running
|
||||
// on Nano as an OS and having targeted the .NET Core framework, thus this code
|
||||
// will continue to fail on Nano (as there is no browser), but at least is
|
||||
// implemented for .NET Core PowerShell on Windows
|
||||
}
|
||||
else if (Platform.IsOSX) {
|
||||
invokeProcess.StartInfo.FileName = "open";
|
||||
|
||||
Reference in New Issue
Block a user