Worker CLI oddness with popd

feamsr00's Avatar

feamsr00

08 Jul, 2019 04:25 AM

Hello!

So... question. Is there anything odd or non-standard in the AppVeyor installation of windows or cmd.exe? I've seen some downright unbelievable behavior (in a narrow, but not edge case). This behavior I have reproduced to a specific test project [1]. Among other, this script has the popd command. popd is a fairly simple command, easy to use, and, generally, doesn't fail randomly[2]. However, it seems to consistently produce Command exited with code 1. This is.... baffling! popd has nothing to do other than to leave a directory that was entered via pushd[2] It is to do so with no positive ERRORLEVEL. Popd was not used incorrectly and I assure you the behavior is completely unexpected. Please note this simple run on my machine (really any windows machine >=NT5 iirc):

>mkdir dir

>pushd dir

.\dir>cd
C:\dev\projects\onx\onx.toolkits\parallax\dir

.\dir>popd

>echo %ERRORLEVEL%
0

>popd /?
Changes to the directory stored by the PUSHD command.

POPD


If Command Extensions are enabled the POPD command will delete
any temporary drive letter created by PUSHD when you POPD that
drive off the pushed directory stack.

>popd /foo
The syntax of the command is incorrect.

>echo %ERRORLEVEL%
1

>popd

>echo %ERRORLEVEL%
1

I have illustrated successful usage, which was expect in the build script, and the only known conditions that should generate a !0 ERRORLEVEL [3].

and so... what is happening here?

For Ref:
1: https://ci.appveyor.com/project/NxSys/nothing
2: https://docs.microsoft.com/en-us/windows-server/administration/wind...
3: https://stackoverflow.com/questions/34987885/what-are-the-errorleve...

  1. 1 Posted by feamsr00 on 16 Jul, 2019 07:47 PM

    feamsr00's Avatar

    Hello. Has this issue been reviewed yet?

  2. 2 Posted by Owen McDonnell on 17 Jul, 2019 05:14 AM

    Owen McDonnell's Avatar

    Sorry for the delay, we just saw it today as it got caught up in some spam filter.
    Reviewing now.

  3. 3 Posted by Ilya Finkelshte... on 17 Jul, 2019 08:02 AM

    Ilya Finkelshteyn's Avatar

    It is because AppVeyor starts every CMD command as a new process and it does not "remember" location saved by pushd. Something like pushd adir && cd && popd should work, or you can wrap it into the batch file. If you prefer commands line-by-line in AppVeyor build configuration, you can also use PowerShell (which runs in the same session) Pop-Location and Push-Location commands.

  4. 4 Posted by feamsr00 on 11 Aug, 2019 04:18 AM

    feamsr00's Avatar

    Hello Ilya and thanks for the reply here. Could you help me understand this behavior? What is the rationale behind spinning a new cmd for every line and not having the build process, say, make a temp batch file? What are the implications for environment vars?

  5. 5 Posted by Ilya Finkelshte... on 14 Aug, 2019 06:03 PM

    Ilya Finkelshteyn's Avatar

    I think the reason was proper error handling. No implications on environment variables.

  6. Ilya Finkelshteyn closed this discussion on 14 Oct, 2019 09:01 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

13 Dec, 2019 05:26 PM
13 Dec, 2019 11:28 AM
12 Dec, 2019 09:36 PM
12 Dec, 2019 09:25 PM
12 Dec, 2019 06:01 PM

 

11 Dec, 2019 11:29 PM
11 Dec, 2019 08:47 PM
11 Dec, 2019 01:39 PM
10 Dec, 2019 12:29 AM
09 Dec, 2019 05:35 AM
07 Dec, 2019 04:20 PM