Add GNUMakeManager

This commit is contained in:
Brian Cristante
2021-10-12 14:06:50 -04:00
parent 400b2d879c
commit ccf53338be
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using System.Text.RegularExpressions;
using GitHub.Runner.Sdk;
namespace GitHub.Runner.Worker.Handlers
{
public sealed class GNUMakeManager
{
public GNUMakeManager(IExecutionContext executionContext)
{
_executionContext = executionContext;
}
public void OnDataReceived(object sender, ProcessDataReceivedEventArgs e)
{
var line = e.Data;
var startMatch = s_startMakeTargetRegex.Match(line);
if (startMatch.Success)
{
_executionContext.Output($"[DEBUG] Matched the start of target {startMatch.Value}.");
}
var endMatch = s_endMakeTargetRegex.Match(line);
if (endMatch.Success)
{
_executionContext.Output($"[DEBUG] Matched the end of target {endMatch.Value}.");
}
}
private readonly IExecutionContext _executionContext;
private static readonly Regex s_startMakeTargetRegex = new Regex(@"Must remake target `(.+)'\.$", RegexOptions.Compiled);
private static readonly Regex s_endMakeTargetRegex = new Regex(@"Successfully remade target file `(.+)'\.$", RegexOptions.Compiled);
}
}

View File

@@ -289,6 +289,8 @@ namespace GitHub.Runner.Worker.Handlers
using (var stdoutManager = new OutputManager(ExecutionContext, ActionCommandManager))
using (var stderrManager = new OutputManager(ExecutionContext, ActionCommandManager))
{
var makeManager = new GNUMakeManager(ExecutionContext);
StepHost.OutputDataReceived += makeManager.OnDataReceived;
StepHost.OutputDataReceived += stdoutManager.OnDataReceived;
StepHost.ErrorDataReceived += stderrManager.OnDataReceived;