@@ -3,7 +3,7 @@ module mcl.commands.ci_matrix;
33import std.stdio : writeln, stderr, stdout;
44import std.traits : EnumMembers;
55import std.string : indexOf, splitLines;
6- import std.algorithm : map, filter, reduce, chunkBy, find, any, sort, startsWith, each;
6+ import std.algorithm : map, filter, reduce, chunkBy, find, any, sort, startsWith, each, canFind ;
77import std.file : write, readText;
88import std.range : array, front, join, split;
99import std.conv : to;
@@ -14,7 +14,7 @@ import std.path : buildPath;
1414import std.process : pipeProcess, wait, Redirect, kill;
1515import std.exception : enforce;
1616import std.format : fmt = format;
17- import std.logger : tracef, infof, errorf;
17+ import std.logger : tracef, infof, errorf, warningf ;
1818
1919import mcl.utils.env : optional, MissingEnvVarsException, parseEnv;
2020import mcl.utils.string : enumToString, StringRepresentation, MaxWidth, writeRecordAsTable;
@@ -318,14 +318,20 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t
318318 " --flake" , rootDir ~ " #" ~ flakeAttrPrefix
319319 ];
320320
321+ const commandString = args.join(" " );
322+
321323 tracef(" %-(%s %)" , args);
322324
323325 auto pipes = pipeProcess(args, Redirect.stdout | Redirect.stderr);
324326
327+ void logWarning (string errorMsg)
328+ {
329+ warningf(" Command `%s` stderr:\n ---\n %s\n ---" , commandString, errorMsg);
330+ }
331+
325332 void logError (string errorMsg)
326333 {
327- errorf(" Command `%s` failed with error:\n ---\n %s\n ---" ,
328- args, errorMsg);
334+ errorf(" Command `%s` failed with error:\n ---\n %s\n ---" , commandString, errorMsg);
329335 }
330336
331337 foreach (line; pipes.stdout.byLine)
@@ -365,13 +371,13 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t
365371 output: pkg.output
366372 ).writeRecordAsTable(stderr.lockingTextWriter);
367373 }
368- foreach (line; pipes.stderr.byLine)
369- {
370- if (uselessWarnings.map! ((warning) => line.indexOf(warning) != - 1 ).any)
371- continue ;
372374
373- logError(line.idup);
374- }
375+ const stderrLogs = pipes.stderr.byLine
376+ .filter! (line => ! uselessWarnings.canFind(line))
377+ .join(" \n " )
378+ .idup;
379+
380+ logWarning(stderrLogs);
375381
376382 int status = wait(pipes.pid);
377383 enforce(status == 0 , " Command `%s` failed with status %s" .fmt(args, status));
0 commit comments