vcpkg icon indicating copy to clipboard operation
vcpkg copied to clipboard

[vcpkg] `vcpkg-init.cmd` returns a non-zero exit code on success

Open benmcmorran opened this issue 2 years ago • 2 comments

Describe the bug

The vcpkg-init.cmd script shows usage information and returns a non-zero exit code despite successfully adding vcpkg to the shells environment.

Environment

  • OS: WIndows 10 CMD
  • Compiler: N/A

To Reproduce Run these commands in a Windows CMD prompt where vcpkg is already installed.

  1. git clone https://github.com/azure-rtos/getting-started
  2. cd getting-started\MXChip\AZ3166
  3. vcpkg activate As expected, this returns an error because vcpkg has not yet been initialized.
  4. %USERPROFILE%\.vcpkg\vcpkg-init.cmd Note that usage information is displayed.
  5. echo %errorlevel%

Expected result: 0 Actual result: 1

Note that even though the exit code is non-zero, running vcpkg activate now will succeed.

benmcmorran avatar Aug 04 '22 16:08 benmcmorran

I can't reproduce this issue in my side, my errorlevel is 0. image

Cheney-W avatar Aug 05 '22 09:08 Cheney-W

Looks like this only repros if vcpkg is installed, but not already initialized. Much simpler repro steps (all in Windows CMD):

  1. curl -LO https://aka.ms/vcpkg-init.cmd && .\vcpkg-init.cmd
  2. Close the terminal window and open a new Windows CMD window.
  3. %USERPROFILE%\.vcpkg\vcpkg-init.cmd
  4. echo %errorlevel%

image

image

benmcmorran avatar Aug 05 '22 16:08 benmcmorran