From 70c23dacd704c66587933985e55b797352ae5e20 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sat, 9 Apr 2016 18:05:49 -0700 Subject: [PATCH] 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 `, and Linux needs to use `xdg-open ` (the most distribution-independent way). Resolves #802. --- src/System.Management.Automation/help/HelpCommands.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/help/HelpCommands.cs b/src/System.Management.Automation/help/HelpCommands.cs index c7172e761..49d08cb04 100644 --- a/src/System.Management.Automation/help/HelpCommands.cs +++ b/src/System.Management.Automation/help/HelpCommands.cs @@ -688,7 +688,16 @@ namespace Microsoft.PowerShell.Commands this.WriteVerbose(string.Format(CultureInfo.InvariantCulture, HelpDisplayStrings.OnlineHelpUri, uriToLaunch.OriginalString)); System.Diagnostics.Process browserProcess = new System.Diagnostics.Process(); browserProcess.StartInfo.UseShellExecute = true; - browserProcess.StartInfo.FileName = uriToLaunch.OriginalString; + if (Platform.IsWindows) + { + 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(); } catch (InvalidOperationException ioe)