mirror of
https://github.com/actions/runner.git
synced 2025-12-13 10:05:23 +00:00
Add GNUMakeManager
This commit is contained in:
36
src/Runner.Worker/Handlers/GNUMakeManager.cs
Normal file
36
src/Runner.Worker/Handlers/GNUMakeManager.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -289,6 +289,8 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
using (var stdoutManager = new OutputManager(ExecutionContext, ActionCommandManager))
|
using (var stdoutManager = new OutputManager(ExecutionContext, ActionCommandManager))
|
||||||
using (var stderrManager = 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.OutputDataReceived += stdoutManager.OnDataReceived;
|
||||||
StepHost.ErrorDataReceived += stderrManager.OnDataReceived;
|
StepHost.ErrorDataReceived += stderrManager.OnDataReceived;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user