Fixed Exit codes not returned correctly

Nov 17, 2015
4
0
I posted this bug a few months ago and had no replies. I am just wondering, should I expect it would ever be fixed? This is pretty significant.

https://jpsoft.com/forums/threads/short-circuiting-of-chained-commands-doesnt-work-with-npm-scripts.7009/

To summarize, in some circumstances, exit codes returned by a process invoked inside a script are not passed on when the script itself exits. This makes any kind of chained process unreliable, e.g. later scripts may execute even though a prior script failed. Since a great many npm packages depend on this kind of functionality for ensuring prerequites to building, testing, and so on succeed, it makes TCC/LE difficult to use with npm and node. But generally, this could affect anything that uses && to chain scripts.

I created a git repo to demonstrate the problem:

https://github.com/jamietre/tccle-issue

The readme shows how to reproduce the problem. The scripts work as expected using normal DOS CMD and bash shells.
 
May 20, 2008
9,536
64
Syracuse, NY, USA
Let's make it very simple. Here are two CMD files everyone should be able to run.
Code:
v:\> type chain1.cmd
@echo off
if "%1" == "1" (cmd /c exit 1) else (echo foo)

v:\> type chain2.cmd
@echo off
echo chain2.cmd was executed
Here's the result of conditional execution with CMD.
Code:
V:\> chain1.cmd 1 && chain2.cmd

V:\>
And here's the result with TCC.
Code:
v:\> chain1.cmd 1 && chain2.cmd
chain2.cmd was executed

v:\>