microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.12k stars 12.5k forks source link

Command line argument validation returns incorrect process exit code #33849

Closed TimvdLippe closed 5 years ago

TimvdLippe commented 5 years ago

TypeScript Version: 3.6.3, 3.6.2 and typescript@next

Search Terms: build option file not found Code

tsc -b bogus.json
echo $?

Expected behavior: In 3.5.3, this still prints the following:

> tsc -b bogus.json
< error TS6053: File 'bogus.jon/tsconfig.json' not found.
> echo $?
< 1

Actual behavior: Since 3.6.2, this prints the following:

> tsc -b bogus.json
< error TS6053: File 'bogus.jon/tsconfig.json' not found.
> echo $?
< 0

As such, it is not possible to detect for infastructure scripts (that invoke tsc) to know when tsc was not able to find the tsconfig.json file.

Playground Link:

Related Issues:

TimvdLippe commented 5 years ago

The same issue happens for the following error:

error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'.

Therefore I assume that all process errors from the command line args validation is returning an error code of 0 instead of 1.