https://bugs.winehq.org/show_bug.cgi?id=57649
Bug ID: 57649 Summary: call .bat doesn't propagate errorlevel Product: Wine Version: 10.0-rc3 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: huangqinjin@gmail.com Distribution: ---
test2.bat:
@echo off call :SetError goto :end
:SetError exit /B 1
:end set a=
test.bat:
@echo off call test2.bat echo %errorlevel%
wine test.bat outputs 0 instead of 1.
https://bugs.winehq.org/show_bug.cgi?id=57649
Eric Pouech eric.pouech@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|wine-bugs@winehq.org |eric.pouech@gmail.com Status|UNCONFIRMED |ASSIGNED CC| |eric.pouech@gmail.com Ever confirmed|0 |1
--- Comment #1 from Eric Pouech eric.pouech@gmail.com --- Created attachment 77785 --> https://bugs.winehq.org/attachment.cgi?id=77785 patch
errorlevel propagation happens "most" of the time (we already have a couple of tests showing that) but we also have to propagate success/failure of last command from child .bat
the non supported case your example shows is something like: - last command of child .bat succeeded, - didn't overwrite the errorlevel, - but errorlevel had been set by a previous command
(so using .cmd extension instead of .bat in test and test2 works!! as set in .cmd always sets errorlevel contrary to .bat where it's only set in case of failure)
note: - I'll have to write likely some more unit tests for this one (to be sure to cover all child termination cases)
attached patch should fix this
https://bugs.winehq.org/show_bug.cgi?id=57649
Eric Pouech eric.pouech@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |562b71de972f8c2e21c7c8e8619 | |de4f06de99195 Status|ASSIGNED |RESOLVED
--- Comment #2 from Eric Pouech eric.pouech@gmail.com --- fixed in 562b71de972f8c2e21c7c8e8619de4f06de99195
https://bugs.winehq.org/show_bug.cgi?id=57649
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 10.0-rc5.