Open davidmatson opened 2 weeks ago
the build outputs an error message when it actually succeeds.
@davidmatson Thanks for posting this issue, could you please provide me with the error log you output?
Command="cmd /c pwsh.exe $(_ZVcpkgAppLocalPowerShellCommonArguments) >NUL 2>&1"
This will only cover up the error but not fix it. 🤔
the build outputs an error message when it actually succeeds. @ davidmatson Thanks for posting this issue, could you please provide me with the error log you output?
Sure; the error message is simply:
'pwsh.exe' is not recognized as an internal or external command,
Command="cmd /c pwsh.exe $(_ZVcpkgAppLocalPowerShellCommonArguments) >NUL 2>&1" This will only cover up the error but not fix it. 🤔
I think the problem is just that the current command attempts to invoke a program that may or may not exist, and then uses the exit code to tell whether it did or not, but that command will naturally error out if the program doesn't exist. If the command is intended just to see if it will fail or not, having the "error" message output isn't great.
Another option would be to use where:
Command="cmd /c where pwsh.exe $(_ZVcpkgAppLocalPowerShellCommonArguments) >NUL 2>&1"
But redirecting stderr is still necessary; where also outputs text to stderr if the program does not exist. If the goal is to determine whether the command exists, I don't think suppressing error output hides the problem; the problem is the spurious error message in build logs.
Describe the bug When building using scripts\buildsystems\msbuild\vcpkg.targets and using Windows PowerShell (rather than PowerShell Core), the build outputs an error message when it actually succeeds.
Environment
To Reproduce Steps to reproduce the behavior:
Expected behavior No error message appears.
Additional context I suspect the code here is the root cause:
Updating that code to use something like
appears likely to fix the problem.