appveyor / ci

AppVeyor community support repository
https://www.appveyor.com
344 stars 66 forks source link

CMD Scripts doesn't execute #3424

Open geghamyan opened 4 years ago

geghamyan commented 4 years ago

Environment:

Example: Because of the installation of MSYS or other components or edited manually, the %PATH% variable looks like this PATH=...;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;...;%SystemRoot%\system32;%SystemRoot...

In command line the where.exe command gives the following result:

C:\Users\user>where cmd
C:\MinGW\msys\1.0\bin\cmd
C:\Windows\System32\cmd.exe

It looks like the build agent internally tries to use "where cmd" command to locate the "cmd.exe" command interpreter and takes the first result which is incorrect. I observe the following in procmon on the BYOC machine:

2:14:33.3259783 PM  powershell.exe  2224    Process Create  C:\Windows\system32\rundll32.exe    SUCCESS PID: 3648, Command line: "C:\Windows\system32\rundll32.exe" C:\Windows\system32\shell32.dll,OpenAs_RunDLL C:\MinGW\msys\1.0\bin\cmd
2:14:33.5245525 PM  powershell.exe  2224    Process Create  C:\Windows\system32\rundll32.exe    SUCCESS PID: 2844, Command line: "C:\Windows\system32\rundll32.exe" C:\Windows\system32\shell32.dll,OpenAs_RunDLL C:\MinGW\msys\1.0\bin\cmd

Possible Fix: Do one of the following:

FeodorFitsner commented 4 years ago

Fair enough, sounds like a bug. Right now cmd is called with cmd /c ... from PowerShell. Should be full path instead.