Fix Get-Help -Online
While Windows will automatically open a URL used as a process by launching a browser, OS X needs to use `open <URL>`, and Linux needs to use `xdg-open <URL>` (the most distribution-independent way). Resolves #802.
This commit is contained in:
parent
76ad94d8a7
commit
70c23dacd7
|
@ -688,7 +688,16 @@ namespace Microsoft.PowerShell.Commands
|
||||||
this.WriteVerbose(string.Format(CultureInfo.InvariantCulture, HelpDisplayStrings.OnlineHelpUri, uriToLaunch.OriginalString));
|
this.WriteVerbose(string.Format(CultureInfo.InvariantCulture, HelpDisplayStrings.OnlineHelpUri, uriToLaunch.OriginalString));
|
||||||
System.Diagnostics.Process browserProcess = new System.Diagnostics.Process();
|
System.Diagnostics.Process browserProcess = new System.Diagnostics.Process();
|
||||||
browserProcess.StartInfo.UseShellExecute = true;
|
browserProcess.StartInfo.UseShellExecute = true;
|
||||||
|
if (Platform.IsWindows)
|
||||||
|
{
|
||||||
browserProcess.StartInfo.FileName = uriToLaunch.OriginalString;
|
browserProcess.StartInfo.FileName = uriToLaunch.OriginalString;
|
||||||
|
} else if (Platform.IsOSX) {
|
||||||
|
browserProcess.StartInfo.FileName = "open";
|
||||||
|
browserProcess.StartInfo.Arguments = uriToLaunch.OriginalString;
|
||||||
|
} else if (Platform.IsLinux) {
|
||||||
|
browserProcess.StartInfo.FileName = "xdg-open";
|
||||||
|
browserProcess.StartInfo.Arguments = uriToLaunch.OriginalString;
|
||||||
|
}
|
||||||
browserProcess.Start();
|
browserProcess.Start();
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException ioe)
|
catch (InvalidOperationException ioe)
|
||||||
|
|
Loading…
Reference in a new issue