[issue3359] Mercurial hg.bat does not forward exit code on Windows

Alexey Borzenkov bugs at mercurial.selenic.com
Mon Apr 9 14:55:49 CDT 2012


New submission from Alexey Borzenkov <snaury at gmail.com>:

Mercurial's hg.bat does not forward exit code from Python to its callers, 
which causes it to always succeed even if Mercurial itself fails. Because of 
this, when Mercurial is installed with e.g. easy_install, other executable 
programs cannot detect whether hg clone or other commands Mercurial commands 
actually succeeded. The tricky part is forwarding exit code correctly to 
both callers from other batch files and executables, which over time have 
been solved for e.g. java and git. Please add this line at the end of 
hg.bat:

if errorlevel 1 %COMSPEC% /c exit /b %errorlevel%

Reference to msysgit repository, where this is used successfully:

https://github.com/msysgit/msysgit/blob/devel/cmd/git.cmd

----------
messages: 19545
nosy: snaury
priority: bug
status: unread
title: Mercurial hg.bat does not forward exit code on Windows

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3359>
____________________________________________________


More information about the Mercurial-devel mailing list