This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ class Command {
58
58
static final RegExp _pathRegex = RegExp (r'\S*clang/bin/clang' );
59
59
static final RegExp _argRegex = RegExp (r'-MF \S*' );
60
60
61
+ // Filter out any extra commands that were appended to the compile command.
62
+ static final RegExp _extraCommandRegex = RegExp (r'&&.*$' );
63
+
61
64
String ? _tidyArgs;
62
65
63
66
/// The command line arguments of the command.
@@ -66,6 +69,7 @@ class Command {
66
69
String result = command;
67
70
result = result.replaceAll (_pathRegex, '' );
68
71
result = result.replaceAll (_argRegex, '' );
72
+ result = result.replaceAll (_extraCommandRegex, '' );
69
73
return result;
70
74
})();
71
75
}
Original file line number Diff line number Diff line change @@ -575,5 +575,16 @@ Future<int> main(List<String> args) async {
575
575
expect (lintAction, equals (LintAction .lint));
576
576
});
577
577
578
+ test ('Command filters out sed command after a compile command' , () {
579
+ final Command command = Command .fromMap (< String , String > {
580
+ 'directory' : '/unused' ,
581
+ 'command' :
582
+ '../../buildtools/mac-x64/clang/bin/clang filename '
583
+ "&& sed -i 's@/b/f/w@../..@g' filename" ,
584
+ 'file' : 'unused' ,
585
+ });
586
+ expect (command.tidyArgs.trim (), 'filename' );
587
+ });
588
+
578
589
return 0 ;
579
590
}
You can’t perform that action at this time.
0 commit comments