Adding logic for invoke-item for non-Windows OSes

This commit is contained in:
Alex Jordan
2016-06-29 10:52:56 -07:00
parent 07501f1d3a
commit eec3b334cc
@@ -1331,7 +1331,22 @@ namespace Microsoft.PowerShell.Commands
if (ShouldProcess(resource, action))
{
System.Diagnostics.Process.Start(path);
System.Diagnostics.Process invokeProcess = new System.Diagnostics.Process();
invokeProcess.StartInfo.UseShellExecute = true;
if (Platform.IsWindows)
{
System.Diagnostics.Process.Start(path);
} else if (Platform.IsOSX) {
invokeProcess.StartInfo.FileName = "open";
invokeProcess.StartInfo.Arguments = path;
} else if (Platform.IsLinux) {
invokeProcess.StartInfo.FileName = "xdg-open";
invokeProcess.StartInfo.Arguments = path;
}
invokeProcess.Start();
//System.Diagnostics.Process.Start(path);
}
} // InvokeDefaultAction
@@ -7784,7 +7799,7 @@ namespace Microsoft.PowerShell.Commands
private bool wait;
/// <summary>
/// When the –Raw switch is present, we don’t do any breaks on newlines,
/// When the �Raw switch is present, we don�t do any breaks on newlines,
/// and only emit one object to the pipeline: all of the content.
/// </summary>
[Parameter]