Skip to content

Commit 1350fe3

Browse files
committed
fix(ts): TS compiler optimised away stdout
1 parent 49bec72 commit 1350fe3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/features/linter-provider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ export class LinterSettings {
7171
this.logger.error(`[lint] Could not spawn ${compiler} to check version.`);
7272
return;
7373
}
74+
// State the variables explicitly bc the TypeScript compiler on the CI
75+
// seemed to optimise away the stdout and regex would return null
7476
const regex = /^GNU Fortran \([\w.-]+\) (?<version>.*)$/gm;
75-
const version = regex.exec(child.stdout.toString().trim()).groups['version'];
77+
const output = child.stdout.toString();
78+
const match = regex.exec(output);
79+
const version = match ? match.groups.version : undefined;
7680
if (semver.valid(version)) {
7781
this.version = version;
7882
this.logger.info(`[lint] Found GNU Fortran version ${version}`);

0 commit comments

Comments
 (0)