Re: Errorlevel
Greetings, Gluszczak, Glenn! > Sorry it's a Windows defect. Builtin CMD echo does not set an errorlevel. Since it is a documented effect, it's a feature. Internal commands do not set %ERRORLEVEL%. > -Original Message- > From: Gluszczak, Glenn > Sent: Thursday, September 22, 2016 2:48 PM > To: 'cygwin@cygwin.com' > Subject: Errorlevel > Is this a known defect? The errorlevel of the ls command is passed to the > echo. > $ cmd > Microsoft Windows [Version 6.3.9600] > (c) 2013 Microsoft Corporation. All rights reserved. > C:\cygwin64\home\Administrator>del c:\tmp\hello del c:\tmp\hello Could Not > Find c:\tmp\hello > C:\cygwin64\home\Administrator>ls foo > ls foo > ls: cannot access 'foo': No such file or directory > C:\cygwin64\home\Administrator>echo hello > c:\tmp\hello echo hello > > c:\tmp\hello > C:\cygwin64\home\Administrator>echo %errorlevel% echo %errorlevel% > 2 > C:\cygwin64\home\Administrator>del c:\tmp\hello del c:\tmp\hello > C:\cygwin64\home\Administrator>echo hello > c:\tmp\hello echo hello > > c:\tmp\hello > C:\cygwin64\home\Administrator>echo %errorlevel% echo %errorlevel% > 0 > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple -- With best regards, Andrey Repin Friday, September 23, 2016 11:32:44 Sorry for my terrible english... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
RE: Errorlevel
Sorry it's a Windows defect. Builtin CMD echo does not set an errorlevel. Glenn -Original Message- From: Gluszczak, Glenn Sent: Thursday, September 22, 2016 2:48 PM To: 'cygwin@cygwin.com' Subject: Errorlevel Is this a known defect? The errorlevel of the ls command is passed to the echo. $ cmd Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\cygwin64\home\Administrator>del c:\tmp\hello del c:\tmp\hello Could Not Find c:\tmp\hello C:\cygwin64\home\Administrator>ls foo ls foo ls: cannot access 'foo': No such file or directory C:\cygwin64\home\Administrator>echo hello > c:\tmp\hello echo hello > c:\tmp\hello C:\cygwin64\home\Administrator>echo %errorlevel% echo %errorlevel% 2 C:\cygwin64\home\Administrator>del c:\tmp\hello del c:\tmp\hello C:\cygwin64\home\Administrator>echo hello > c:\tmp\hello echo hello > c:\tmp\hello C:\cygwin64\home\Administrator>echo %errorlevel% echo %errorlevel% 0 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Errorlevel
In appereance it happens with standard DOS commands too: C:\windows\system32>dir foo Directorio de C:\windows\system32 No se encuentra el archivo C:\windows\system32>echo %errorlevel% 1 C:\windows\system32>ls foo ls: cannot access 'foo': No such file or directory C:\windows\system32>echo %errorlevel% 2 C:\windows\system32>dir foo Directorio de C:\windows\system32 No se encuentra el archivo C:\windows\system32>echo %errorlevel% 1 Gracias | Regards - Saludos | Greetings | Freundliche Grüße | Salutations -- Sergio Pedraja -- twitter: @sergio_pedraja | skype: Sergio Pedraja - No crea todo lo que ve, ni crea que está viéndolo todo - "El estado de una Copia de Seguridad es desconocido hasta que intentas restaurarla" (- nixCraft) 2016-09-22 20:47 GMT+02:00 Gluszczak, Glenn : > > Is this a known defect? The errorlevel of the ls command is passed to the > echo. > > $ cmd > Microsoft Windows [Version 6.3.9600] > (c) 2013 Microsoft Corporation. All rights reserved. > > C:\cygwin64\home\Administrator>del c:\tmp\hello > del c:\tmp\hello > Could Not Find c:\tmp\hello > > C:\cygwin64\home\Administrator>ls foo > ls foo > ls: cannot access 'foo': No such file or directory > > C:\cygwin64\home\Administrator>echo hello > c:\tmp\hello > echo hello > c:\tmp\hello > > C:\cygwin64\home\Administrator>echo %errorlevel% > echo %errorlevel% > 2 > > C:\cygwin64\home\Administrator>del c:\tmp\hello > del c:\tmp\hello > > C:\cygwin64\home\Administrator>echo hello > c:\tmp\hello > echo hello > c:\tmp\hello > > C:\cygwin64\home\Administrator>echo %errorlevel% > echo %errorlevel% > 0 > > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: ERRORLEVEL not returning to Cygwin shell
Greetings, paul.hermeneu...@gmail.com! > I am using CYGWIN_NT-5.1 PAC047922 1.7.25(0.270/5/3) 2013-08-31 20:39 > i686 Cygwin > An exit code returned by a DOS batch file does not seem to be coming > back to the Cygwin shell. I am using bash. > $ cat myexit.bat > @echo off > set EXITCODE=%1 > echo got here with %1 > exit /b %EXITCODE% > $ cmd /c c:/DOCUME~1/pwatson/bin/myexit.bat 8 > got here with 8 > $ echo $? > 0 Carry this case to appropriate forums. [C:\]$ cat test.bat cmd.exe /C C:\testcase.bat echo %ERRORLEVEL% [C:\]$ cat testcase.bat @exit /B 8 [C:\]$ test.bat 0 [C:\]$ -- WBR, Andrey Repin (anrdae...@yandex.ru) 12.10.2013, <00:39> Sorry for my terrible english... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: ERRORLEVEL not returning to Cygwin shell
On 10/11/2013 11:53 AM, Christopher Faylor wrote: On Fri, Oct 11, 2013 at 10:42:47AM -0400, Earnie Boyd wrote: On Fri, Oct 11, 2013 at 10:35 AM, Nellis, Kenneth wrote: From: Larry Hall (Cygwin) On 10/11/2013 8:27 AM, paul hermeneutic wrote: I am using CYGWIN_NT-5.1 PAC047922 1.7.25(0.270/5/3) 2013-08-31 20:39 i686 Cygwin An exit code returned by a DOS batch file does not seem to be coming back to the Cygwin shell. I am using bash. $ cat myexit.bat @echo off set EXITCODE=%1 echo got here with %1 exit /b %EXITCODE% $ cmd /c c:/DOCUME~1/pwatson/bin/myexit.bat 8 got here with 8 $ echo $? 0 WJFFM. Same version, same arch. Guess you need to do some more digging. FWIW, I get the same results as the OP: $ cat myexit.bat @echo off set EXITCODE=%1 echo got here with %1 exit /b %EXITCODE% $ cmd /c myexit.bat 8 got here with 8 $ echo $? 0 $ uname -r 1.7.25(0.270/5/3) $ For grins, I tried with both Unix and DOS line endings. Made no difference. Cygwin has no control and loses all communication with the cmd.exe child process. How is it supposed to return anything other than an exit code of 0 because cmd.exe exited normally. You simply cannot mix Windows and Cygwin like this. exit /b seems to cause CMD to exit with that value. It does for me: % cmd /c myexit.bat 9; echo SAW $? got here with 9 SAW 9 This is on Windows 7 64. Maybe other versions of Windows differ. Don't know if it's significant or not but I'm running W7 64 too, running Cygwin 32bit. -- Larry _ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: ERRORLEVEL not returning to Cygwin shell
On Fri, Oct 11, 2013 at 10:42:47AM -0400, Earnie Boyd wrote: >On Fri, Oct 11, 2013 at 10:35 AM, Nellis, Kenneth wrote: >>> From: Larry Hall (Cygwin) >>> >>> On 10/11/2013 8:27 AM, paul hermeneutic wrote: >>> > I am using CYGWIN_NT-5.1 PAC047922 1.7.25(0.270/5/3) 2013-08-31 20:39 >>> > i686 Cygwin >>> > >>> > An exit code returned by a DOS batch file does not seem to be coming >>> > back to the Cygwin shell. I am using bash. >>> > >>> > $ cat myexit.bat >>> > @echo off >>> > set EXITCODE=%1 >>> > echo got here with %1 >>> > exit /b %EXITCODE% >>> > >>> > $ cmd /c c:/DOCUME~1/pwatson/bin/myexit.bat 8 >>> > got here with 8 >>> > >>> > $ echo $? >>> > 0 >>> >>> WJFFM. Same version, same arch. Guess you need to do some more digging. >> >> FWIW, I get the same results as the OP: >> >> $ cat myexit.bat >> @echo off >> set EXITCODE=%1 >> echo got here with %1 >> exit /b %EXITCODE% >> $ cmd /c myexit.bat 8 >> got here with 8 >> $ echo $? >> 0 >> $ uname -r >> 1.7.25(0.270/5/3) >> $ >> >> For grins, I tried with both Unix and DOS line endings. Made no difference. > >Cygwin has no control and loses all communication with the cmd.exe >child process. How is it supposed to return anything other than an >exit code of 0 because cmd.exe exited normally. You simply cannot mix >Windows and Cygwin like this. exit /b seems to cause CMD to exit with that value. It does for me: % cmd /c myexit.bat 9; echo SAW $? got here with 9 SAW 9 This is on Windows 7 64. Maybe other versions of Windows differ. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: ERRORLEVEL not returning to Cygwin shell
On Fri, Oct 11, 2013 at 10:35 AM, Nellis, Kenneth wrote: >> From: Larry Hall (Cygwin) >> >> On 10/11/2013 8:27 AM, paul hermeneutic wrote: >> > I am using CYGWIN_NT-5.1 PAC047922 1.7.25(0.270/5/3) 2013-08-31 20:39 >> > i686 Cygwin >> > >> > An exit code returned by a DOS batch file does not seem to be coming >> > back to the Cygwin shell. I am using bash. >> > >> > $ cat myexit.bat >> > @echo off >> > set EXITCODE=%1 >> > echo got here with %1 >> > exit /b %EXITCODE% >> > >> > $ cmd /c c:/DOCUME~1/pwatson/bin/myexit.bat 8 >> > got here with 8 >> > >> > $ echo $? >> > 0 >> >> WJFFM. Same version, same arch. Guess you need to do some more digging. > > FWIW, I get the same results as the OP: > > $ cat myexit.bat > @echo off > set EXITCODE=%1 > echo got here with %1 > exit /b %EXITCODE% > $ cmd /c myexit.bat 8 > got here with 8 > $ echo $? > 0 > $ uname -r > 1.7.25(0.270/5/3) > $ > > For grins, I tried with both Unix and DOS line endings. Made no difference. Cygwin has no control and loses all communication with the cmd.exe child process. How is it supposed to return anything other than an exit code of 0 because cmd.exe exited normally. You simply cannot mix Windows and Cygwin like this. -- Earnie -- https://sites.google.com/site/earnieboyd -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
RE: ERRORLEVEL not returning to Cygwin shell
> From: Larry Hall (Cygwin) > > On 10/11/2013 8:27 AM, paul hermeneutic wrote: > > I am using CYGWIN_NT-5.1 PAC047922 1.7.25(0.270/5/3) 2013-08-31 20:39 > > i686 Cygwin > > > > An exit code returned by a DOS batch file does not seem to be coming > > back to the Cygwin shell. I am using bash. > > > > $ cat myexit.bat > > @echo off > > set EXITCODE=%1 > > echo got here with %1 > > exit /b %EXITCODE% > > > > $ cmd /c c:/DOCUME~1/pwatson/bin/myexit.bat 8 > > got here with 8 > > > > $ echo $? > > 0 > > WJFFM. Same version, same arch. Guess you need to do some more digging. FWIW, I get the same results as the OP: $ cat myexit.bat @echo off set EXITCODE=%1 echo got here with %1 exit /b %EXITCODE% $ cmd /c myexit.bat 8 got here with 8 $ echo $? 0 $ uname -r 1.7.25(0.270/5/3) $ For grins, I tried with both Unix and DOS line endings. Made no difference. --Ken Nellis -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: ERRORLEVEL not returning to Cygwin shell
On 10/11/2013 8:27 AM, paul.hermeneu...@gmail.com wrote: I am using CYGWIN_NT-5.1 PAC047922 1.7.25(0.270/5/3) 2013-08-31 20:39 i686 Cygwin An exit code returned by a DOS batch file does not seem to be coming back to the Cygwin shell. I am using bash. $ cat myexit.bat @echo off set EXITCODE=%1 echo got here with %1 exit /b %EXITCODE% $ cmd /c c:/DOCUME~1/pwatson/bin/myexit.bat 8 got here with 8 $ echo $? 0 WJFFM. Same version, same arch. Guess you need to do some more digging. -- Larry _ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple