| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT) I think we should simply revert a change in line 557 As for test, you could see last test in Invoke-Item.Tests,ps1 file: |
Sorry, something went wrong.
|
Ilya (@iSazonov) the problem is if anyone updates the code and uses CheckIfConsoleApplication() it will have a similar problem as IsWindowsApplication doesn't get updated if we just do the change you are suggesting. As for the test, it appears the hang only occurs if the associated process explicitly supports elevation like mmc.exe. I can add a test that runs if diskmgmt.msc and mmc.exe are on the system, otherwise it'll be skipped. At least it can work locally. |
Sorry, something went wrong.
My thoughts is that switching to mmc.exe is temporary and we should follow diskmgmt.msc. Otherwise it will very tricky code - input is diskmgmt.msc but result is for mmc.exe. |
Sorry, something went wrong.
|
Ilya (@iSazonov) but diskmgmt.msc is not the process so following it doesn't make sense unless I'm misunderstanding. Removing IsWindowsApplication and IsConsoleApplication makes sense. |
Sorry, something went wrong.
|
If we remove IsWindowsApplication we remove _isWindowsApplication and this resolves our discussion (til we will want to make IsWindowsApplication public :-) ) |
Sorry, something went wrong.
| _startPosition = new Host.Coordinates(); | ||
|
|
||
| CalculateIORedirection(out redirectOutput, out redirectError, out redirectInput); | ||
| bool isWindowsApplication = IsWindowsApplication(this.Path); |
There was a problem hiding this comment.
These names are so similar that it can be confused. Can we keep the old name for the method?
Sorry, something went wrong.
There was a problem hiding this comment.
The old name with the Check makes it slightly harder to understand reading the code as it's not as clear what true/false means with Check vs Is. The alternative is to have the local variable be isConsoleApplication to differentiate I guess.
Sorry, something went wrong.
There was a problem hiding this comment.
We could use bool windowsApplication without Bulgarian prefix.
If no I agreed with isWindowsApplication.
Sorry, something went wrong.
There was a problem hiding this comment.
Since this code currently is only used in one place, I think the casing diff is ok and prefer the is making it a bit more readable
Sorry, something went wrong.
|
As unrelated notice. The code fallback to default shell (cmd.exe/bash) to invoke an item. But what if we assign PowerShell as default shell? Infinite cycle? |
Sorry, something went wrong.
|
Ilya (@iSazonov) can you point me to what code you are referring to? |
Sorry, something went wrong.
|
In the context - line 488. If UseShellExecute is true we call PowerShell again? |
Sorry, something went wrong.
|
Ilya (@iSazonov) that line with UseShellExecute only starts a new process if the previous attempt fails because it's not an executable and isn't associated with an executable so it tries to let the Shell try to start it. I don't see the problem. |
Sorry, something went wrong.
|
I mean the code PowerShell/src/System.Management.Automation/engine/NativeCommandProcessor.cs Lines 478 to 490 in f2a3716 If PowerShell is default shell the code will run PowerShell again and again. |
Sorry, something went wrong.
|
Ilya (@iSazonov) ok, now I see what you mean. However, on my macBook I can see that Process.Start() doesn't start a new shell to run the exe. |
Sorry, something went wrong.
|
I'd expect the cycle with:
In line 534 we will have UseShellExecute = true and run PowerShell again. |
Sorry, something went wrong.
|
Ilya (@iSazonov) perhaps you can open a new issue to discuss that specific concern, I don't see additional pwsh processes, however |
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT) I looked at the UseShellExecute implementation. It does not use a call to default shell. On Windows it uses ShellExecuteEx P/Invoke, on Unix it uses x-bit. So the cycle would be only if PowerShell associated with the extension or file. |
Sorry, something went wrong.
|
🎉v7.1.0-rc.2 has been released which incorporates this pull request.:tada: Handy links: |
Sorry, something went wrong.
|
🎉v7.2.0-preview.1 has been released which incorporates this pull request.:tada: Handy links: |
Sorry, something went wrong.
|
Is this in 7.1 stable? I don't see a revert to this commit in the diff log between 7.1 and 7.1-rc2, but it's re-incorporated in 7.2 preview 1. |
Sorry, something went wrong.
|
It was included in v7.2.0-preview.1. You can check that 7.1 works well in the scenario. |
Sorry, something went wrong.
So... both versions have it? |
Sorry, something went wrong.
|
Yes, both. |
Sorry, something went wrong.
…ation (PowerShell#13750) * Fix blocking wait when starting file associated with a Windows application in elevated process * refactor check if app is WindowsApp
| Back | FazBrowse Home | New Git URL |
PR Summary
Change #13481 modified some logic on how console apps are detected. The problem in this situation is:
Fix is to change CheckIfConsoleApplication() to be non-static so that the second time it's called it updates _isWindowsApplication to point to the new exe and not the previous file.
Tested manually. Since CI won't have a Windows app associated with a file, can't create a test case.
PR Context
Fix #13744
PR Checklist