Windows build number: Windows_NT x64 10.0.19041.0
Windows Terminal version: 1.2.2381.0 1.3.2382.0
Any other software? VSCode Version: 1.48.2
wt or by search terminal in start menu and run or click to run.nvim or get-help | lessNeovim launches or less launches.
When using stable version of Windows Terminal, if run with wt, nvim and less won't give any output. This appies to the integrated terminal in a VSCode launches by pressing Ctrl + , in Windows Terminal, too.
But if I launch Windows Terminal in the same way as other UWP, there is no problem.
When using preview version of Windows Terminal, this problem only exist when run with wt and launch VSCode by Ctrl + ,, and then try nvim or less in VSCode's intergrated terminal.
I think this is caused by https://github.com/microsoft/terminal/issues/7204. As a workaround, you could rename or delete the Path value (not the default value) at HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe.
When using preview version of Windows Terminal, this problem only exist when run with
wtand launch VSCode by Ctrl + ,
https://github.com/microsoft/terminal/issues/7204 was fixed for the child processes that Windows Terminal starts for new tabs or panes, but Process Monitor shows that the Path change still leaks to the child process that Windows Terminal starts for editing the settings, and to C:\WINDOWS\system32\wsl.exe --list as well.
The Path change also propagates to the Web browser processes started by the Feedback menu item or by hyperlinks on the About screen.
I think it would be best to make wt.exe delete the installation directory from its in-process Path environment variable so that WindowsTerminal.exe never inherits it. That would prevent similar issues later in other features that start child processes.
I'd like to understand what part of having wt's application directory in PATH causes this. I can't reproduce it, and have never had an application fail to launch through WT unexpectedly.
What is your proposed method of action? @escape0707 you used the :+1: reaction on all of @KalleOlaviNiemitalo's comments; does that indicate that they fixed your issue?
@KalleOlaviNiemitalo @DHowett Thank you for all you guys' investigation.
Yes, @KalleOlaviNiemitalo's workaround fix that problem. I renamed those two Path in regedit.exe to Path1 and it works like expected, under both situations described in the original post.
I think it might worth noting that I installed VSCode-portable and Neovim through scoop package manager. But as I try to invoke nvim directly by it's absolute path and still failed, I think it at least might not be a scoop only problem. I also installed oh-my-posh and made my own $Profile but I ensured I had removed them and tested again before filed this issue.
Another note: For Windows Terminal Preview, there is no HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe, but change the other one is needed to workaround with this issue for me.
For this issue, I don't know where to find a proper log, as nvim just seems not being launched at all and no error message gived in terminal. VSCode-Vim do give an error as I enabled neovim for it and use nvim for neovim path. When this issue happens, VSCode gives this error when launched:
Configuration: Invalid neovimPath. Command failed: C:\Users\tothe\scoop\shims\nvim.exe
--version.Tried to parse PATH C:\Users\tothe\scoop\shims\nvim.exe.
I don't know how the extra entry in Path causes the error, but given the conditions in which the error does or doesn't occur, it must be involved. (Or perhaps Path just becomes too long overall?)
@escape0707, can you use Process Monitor to check what Scoop's wrapper or Neovim itself loads from the Windows Terminal directory?
@KalleOlaviNiemitalo Will this be useful?
Logfile.zip
I run Process Monitor and add Process Name is nvim.exe to filter, clicked Clear, Win+R wt, nvim + Enter. And got this.
Logfile.zip
And this is what I set the filter to Parent PID is {WindowsTerminal.exe's PID}, Clear and run nvim got. Both this and the above post's log is for Windows Terminal, not the preview version.
From the logs, the problem seems related to vcruntime140.dll. The nvim.exe process manages to open C:\Users\tothe\scoop\apps\neovim\0.4.4\bin\vcruntime140.dll (a reparse point is involved) and calls NtCreateSection but then closes the file without a Load Image event. After that, it tries to open VCRUNTIME140.dll from several other directories. It successfully opens C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.2.2381.0_x64__8wekyb3d8bbwe\vcruntime140.dll for Read Attributes access but then gets an ACCESS DENIED error when trying to open that again for Execute access.
Can you also post a Process Monitor log of how nvim.exe starts successfully (e.g. in Windows Terminal Preview)?
Is C:\Users\tothe\scoop\apps\neovim\current a symbolic link or junction that points to C:\Users\tothe\scoop\apps\neovim\0.4.4?
Your computer does not appear to have C:\Windows\System32\VCRUNTIME140.dll. Perhaps installing Microsoft Visual C++ Redistributable would also work around this error, but similar errors might still occur with other DLLs.
This is the successful run's log from Windows Terminal stable version invoked from Start menu app icon. And I followed your amazing way and discovered that this time neovim seems to be using python's vcruntime140.dll, which isn't what I expected...
C:\Users\tothe\scoop\apps\neovim\current is a symbolic link created by scoop to allow it to install, update and switch between each portable version of apps, etc. But I don't really understood too much of that.
I installed vcredist2019 and it works for Win+R+wt enviroment now. Thanks for your highly valuable time and effort! I literally have no experience about this kind of system and resources related problem.
I think I'll take care of installing vcredist later on when I use nvim or less on windows. And if this behavior is actually not a bug but expected consequence, maybe I should close this issue? I don't know it's because there is a reachable vcruntime140.dll provided by python added to the path that shadowed the fact of lacking a vcredist....
I think it's still a bug in Windows Terminal, which should not include its installation directory in the Path environment variable that child processes receive. Perhaps it's best to reopen https://github.com/microsoft/terminal/issues/7204 as https://github.com/microsoft/terminal/pull/7243 did not fix it for the settings editor and the about screen, and then close this one.
A separate bug report could be filed on Scoop, to let its maintainers investigate why the nvim.exe process tries to load vcruntime140.dll from Path even though it has a local C:\Users\tothe\scoop\apps\neovim\0.4.4\bin\vcruntime140.dll as well. Perhaps this is somehow caused by Scoop's symbolic link or by incorrect Authenticode signatures (a guess because NtCreateSection looked at HKLM\System\CurrentControlSet\Control\CI, i.e. Code Integrity).
I agree with you. I'll search in scoop repo for the dll problem later on and close this issue now.
Most helpful comment
From the logs, the problem seems related to
vcruntime140.dll. Thenvim.exeprocess manages to openC:\Users\tothe\scoop\apps\neovim\0.4.4\bin\vcruntime140.dll(a reparse point is involved) and calls NtCreateSection but then closes the file without a Load Image event. After that, it tries to openVCRUNTIME140.dllfrom several other directories. It successfully opensC:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.2.2381.0_x64__8wekyb3d8bbwe\vcruntime140.dllfor Read Attributes access but then gets an ACCESS DENIED error when trying to open that again for Execute access.Can you also post a Process Monitor log of how
nvim.exestarts successfully (e.g. in Windows Terminal Preview)?Is
C:\Users\tothe\scoop\apps\neovim\currenta symbolic link or junction that points toC:\Users\tothe\scoop\apps\neovim\0.4.4?Your computer does not appear to have
C:\Windows\System32\VCRUNTIME140.dll. Perhaps installing Microsoft Visual C++ Redistributable would also work around this error, but similar errors might still occur with other DLLs.