Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

TCC/CMD difference

Jun
40
0
Hi

I have discovered this difference while running the flutter.bat file provided by Google:
Code:
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1

In CMD, if the first command succeeds, nothing happens. If it fails, a message is shown and the script is terminated. In TCC, if the first command succeeds, no message is shown but the script is still terminated. So it seems that CMD and TCC do not quite agree on operator precedence here.

A well-placed set of parentheses solves this:
Code:
REM Test if Git is available on the Host
where /q git || (ECHO Error: Unable to find git in your PATH. && EXIT /B 1)
but this correction will have to be made every time Google updates this file.

- Ebbe
 
You might try the Duplicate Bugs option:

Duplicate-bugs.png
 
Bump!

I ran into this bug again yesterday. And since all interaction with flutter goes through the flutter.bat file, this is really annoying.
 
I have discovered this difference while running the flutter.bat file provided by Google:
Code:
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1

That line isn't correct in either CMD or TCC. The && should be a single & - an ECHO will always return a 0, so the && is pointless. The only reason to use && is if you wanted to do a conditional operation here -- which you don't.

In CMD, there's a bug where it throws away the entire command line following a failed ||. I chose not to emulate this bug because (1) it's dumb, and (2) it would break existing TCC functionality.
 
You should submit a pull request to change it to:
Code:
where /q git || (ECHO Error: Unable to find git in your PATH. & EXIT /B 1)
which is correct for CMD.‍EXE as well as TCC.‍EXE. the fact that paren-less it does different things with & vs && means that it works at all is a bug.
 
Back
Top
[FOX] Ultimate Translator
Translate