Skip to content

Commit 4a85546

Browse files
Merge pull request microsoft#4497 from weswigham/patch-4
Add system argument to readConfigFile
2 parents 69b9a1b + f1dbf90 commit 4a85546

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ namespace ts {
379379
* Read tsconfig.json file
380380
* @param fileName The path to the config file
381381
*/
382-
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
382+
export function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic } {
383383
let text = "";
384384
try {
385-
text = sys.readFile(fileName);
385+
text = readFile(fileName);
386386
}
387387
catch (e) {
388388
return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };

src/compiler/tsc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ namespace ts {
216216
if (!cachedProgram) {
217217
if (configFileName) {
218218

219-
let result = readConfigFile(configFileName);
219+
let result = readConfigFile(configFileName, sys.readFile);
220220
if (result.error) {
221221
reportDiagnostic(result.error);
222222
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);

0 commit comments

Comments
 (0)