comparison tests/test-alias.t @ 23934:975c4fc4a512 stable

hg.bat: return exit code explicitly for indirect invocation When "hg.bat" is invoked via interactive shell "cmd.exe" on Windows, it can store own exit code into ERRORLEVEL correctly, regardless of explicit "exit" statement in it: "cmd.exe" seems to hold ERRORLEVEL updated by the last command in the batch file (= "python hg", in "hg.bat" case). On the other hand, "hg.bat" is invoked indirectly via "subprocess.Popen" (e.g. shell alias, hooks, hgclient and so on), the parent process always receives exit code 0 from spawned "hg.bat": batch files on Windows seem not to be really spawned like as shell scripts on UNIX, but to be executed in the "cmd.exe" process. This patch returns exit code explicitly for indirect invocation. "/b" should be specified for "exit" to prevent "cmd.exe" from being terminated when "hg.bat" is invoked interactively from it.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 22 Jan 2015 00:07:06 +0900
parents 3bd577a3283e
children 02d7b5cd373b
comparison
equal deleted inserted replaced
23933:769027075e21 23934:975c4fc4a512
523 $ hg mycommit -R alias 523 $ hg mycommit -R alias
524 nothing changed 524 nothing changed
525 [1] 525 [1]
526 $ hg exit1 526 $ hg exit1
527 [1] 527 [1]
528
529 #if no-outer-repo
530 $ hg root
531 abort: no repository found in '$TESTTMP' (.hg not found)!
532 [255]
533 $ hg --config alias.hgroot='!hg root' hgroot
534 abort: no repository found in '$TESTTMP' (.hg not found)!
535 [255]
536 #endif