Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9a5169f

Browse files
committed
More debugging.
1 parent a0e7cc0 commit 9a5169f

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

tools/clangd_check/bin/main.dart

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,26 @@ void main(List<String> args) {
6161
}
6262

6363
// Run clangd.
64-
final io.ProcessResult result = io.Process.runSync(clangd, <String>[
65-
'--compile-commands-dir',
66-
compileCommandsDir,
67-
'--check=$checkFile',
68-
]);
69-
io.stdout.write(result.stdout);
70-
io.stderr.write(result.stderr);
71-
if ((result.stderr as String).contains('Path specified by --compile-commands-dir does not exist')) {
72-
io.stdout.writeln('clangd_check failed: --compile-commands-dir does not exist');
64+
try {
65+
final io.ProcessResult result = io.Process.runSync(clangd, <String>[
66+
'--compile-commands-dir',
67+
compileCommandsDir,
68+
'--check=$checkFile',
69+
]);
70+
io.stdout.write(result.stdout);
71+
io.stderr.write(result.stderr);
72+
if ((result.stderr as String).contains('Path specified by --compile-commands-dir does not exist')) {
73+
io.stdout.writeln('clangd_check failed: --compile-commands-dir does not exist');
74+
io.exitCode = 1;
75+
} else if ((result.stderr as String).contains('Failed to resolve path')) {
76+
io.stdout.writeln('clangd_check failed: --check file does not exist');
77+
io.exitCode = 1;
78+
} else {
79+
io.exitCode = result.exitCode;
80+
}
81+
} on io.ProcessException catch (e) {
82+
io.stderr.writeln('Failed to run clangd: $e');
83+
io.stderr.writeln(const JsonEncoder.withIndent(' ').convert(entry));
7384
io.exitCode = 1;
74-
} else if ((result.stderr as String).contains('Failed to resolve path')) {
75-
io.stdout.writeln('clangd_check failed: --check file does not exist');
76-
io.exitCode = 1;
77-
} else {
78-
io.exitCode = result.exitCode;
7985
}
8086
}

0 commit comments

Comments
 (0)