Enable UseShellExecute on all platforms#7198
Conversation
31436bc to
143ba8e
Compare
143ba8e to
1fe5fea
Compare
| Test-Path $renamedtestfilepath | Should -BeTrue | ||
| } | ||
|
|
||
| It "Should invoke an executable file without error" -Skip:(!$IsWindows) { |
There was a problem hiding this comment.
Please clarify why we remove previous all-platform test and add this new for Windows only?
There was a problem hiding this comment.
The previous test expected UseShellExecute to only be available on Windows and the previous code was checking for different behavior on non-Windows. Since I've changed it to only use ShellExecute on non-Windows if the target is not an executable, I should put back this test.
cefd7a9 to
b2a5a6f
Compare
iSazonov
left a comment
There was a problem hiding this comment.
LGTM with minor comment.
| //so don't use ShellExecute if arguments are specified | ||
|
|
||
| //Linux relies on `xdg-open` and macOS relies on `open` which behave differently than Windows ShellExecute when running console commands | ||
| //as a new console will be opened. So to avoid that, we only use ShellExecute on non-Windows if the filename is not an actual command (like a URI) |
There was a problem hiding this comment.
Please add space after // in comments.
There was a problem hiding this comment.
I was following the existing comments
There was a problem hiding this comment.
Yes, I see. But if we continue use CodeFactor we have to fix every code block without following file style.
There was a problem hiding this comment.
I'll update this file with whitespace as a separate commit so it doesn't make the overall code review noisy
|
|
||
| #endregion Internal | ||
| }//ProcessBaseCommand | ||
| } // ProcessBaseCommand |
There was a problem hiding this comment.
I would delete such comments. They are useless in modern IDEs.
|
|
||
| ///<summary> | ||
| ///To display the modules of a process | ||
| /// To display the modules of a process |
|
|
||
| ///<summary> | ||
| ///To display the fileversioninfo of the main module of a process | ||
| /// To display the fileversioninfo of the main module of a process |
…nd adding period to end of summaries
|
@iSazonov did a pass through the comments, removed a bunch of unnecessary ones and added punctuation to the summaries. However, this PR has grown much larger than the original issue. I think in general, we want CodeFactor issues outside of the changes to be a separate PR. |
|
@SteveL-MSFT I agree that large style fixes we should place in separate PR. A separate style fix commit is suitable for small changes. |
PR Summary
Previously, we limited use of UseShellExecute when starting a new process to only Windows Desktop. However, corefx now supports UseShellExecute (appropriately calling
openon macOS andxdg-openon Linux) so we can have consistent code and remove some of the existing redundant code or unnecessary limiting code.There is a bug in corefx where Arguments is passed to the executable used to
ShellExecutesuch asopenon macOS instead of the FileName intended to be started, so don't useShellExecuteif arguments is passed.Also, because of difference in behavior with using
ShellExecutewith console apps compared to Windows where a new console window is opened, we only useShellExecuteifFileNamedoesn't refer to an actual command, like a URL.Fix #5715
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests