From e580941667329312e73163281f46c873c55855d2 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Tue, 5 Jul 2016 16:05:58 -0700 Subject: [PATCH] UseShellExecute moved to OS guards for Invoke-Item --- .../namespaces/FileSystemProvider.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index c7a69fd540..b1f4abac39 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -1331,22 +1331,25 @@ namespace Microsoft.PowerShell.Commands if (ShouldProcess(resource, action)) { - System.Diagnostics.Process invokeProcess = new System.Diagnostics.Process(); - invokeProcess.StartInfo.UseShellExecute = true; - if (Platform.IsWindows) { System.Diagnostics.Process.Start(path); - } else if (Platform.IsOSX) { + } + else if (Platform.IsOSX) { + System.Diagnostics.Process invokeProcess = new System.Diagnostics.Process(); + invokeProcess.StartInfo.UseShellExecute = true; invokeProcess.StartInfo.FileName = "open"; invokeProcess.StartInfo.Arguments = path; - } else if (Platform.IsLinux) { + } + else if (Platform.IsLinux) { + System.Diagnostics.Process invokeProcess = new System.Diagnostics.Process(); + invokeProcess.StartInfo.UseShellExecute = true; invokeProcess.StartInfo.FileName = "xdg-open"; invokeProcess.StartInfo.Arguments = path; } + invokeProcess.Start(); - //System.Diagnostics.Process.Start(path); } } // InvokeDefaultAction