Skip to content

Commit

Permalink
Fix Runner.Worker build warnings (actions#174)
Browse files Browse the repository at this point in the history
Most of these warnings show up on only certain build OSes because of #ifdefs in the code. The fix is to suppress these warnings.
  • Loading branch information
Eilon authored and thboop committed Nov 6, 2019
1 parent 856b3ec commit 8eef8c1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/Runner.Worker/ActionCommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
break;
default:
throw new Exception($"Invalid echo command value. Possible values can be: 'on', 'off'. Current value is: '{command.Data}'.");
break;
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/Runner.Worker/Container/DockerCommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ public async Task<int> DockerExec(IExecutionContext context, string containerId,
return await ExecuteDockerCommandAsync(context, "exec", $"{options} {containerId} {command}", context.CancellationToken);
}

#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
public async Task<int> DockerExec(IExecutionContext context, string containerId, string options, string command, List<string> output)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{
ArgUtil.NotNull(output, nameof(output));

Expand Down Expand Up @@ -337,7 +339,9 @@ public async Task<List<PortMapping>> DockerPort(IExecutionContext context, strin
return ExecuteDockerCommandAsync(context, command, options, null, cancellationToken);
}

#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
private async Task<int> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options, IDictionary<string, string> environment, EventHandler<ProcessDataReceivedEventArgs> stdoutDataReceived, EventHandler<ProcessDataReceivedEventArgs> stderrDataReceived, CancellationToken cancellationToken = default(CancellationToken))
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{
string arg = $"{command} {options}".Trim();
context.Command($"{DockerPath} {arg}");
Expand All @@ -362,7 +366,9 @@ public async Task<List<PortMapping>> DockerPort(IExecutionContext context, strin
#endif
}

#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
private async Task<int> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options, string workingDirectory, CancellationToken cancellationToken = default(CancellationToken))
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{
string arg = $"{command} {options}".Trim();
context.Command($"{DockerPath} {arg}");
Expand Down
2 changes: 2 additions & 0 deletions src/Runner.Worker/DiagnosticLogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ Task UploadDiagnosticLogsAsync(IExecutionContext executionContext,
public sealed class DiagnosticLogManager : RunnerService, IDiagnosticLogManager
{
private static string DateTimeFormat = "yyyyMMdd-HHmmss";
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
public async Task UploadDiagnosticLogsAsync(IExecutionContext executionContext,
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
IExecutionContext parentContext,
Pipelines.AgentJobRequestMessage message,
DateTime jobStartTimeUtc)
Expand Down
2 changes: 2 additions & 0 deletions src/Runner.Worker/Handlers/ContainerActionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public sealed class ContainerActionHandler : Handler, IContainerActionHandler
{
public ContainerActionExecutionData Data { get; set; }

#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously (method has async logic on only certain platforms)
public async Task RunAsync(ActionRunStage stage)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{
// Validate args.
Trace.Entering();
Expand Down

0 comments on commit 8eef8c1

Please sign in to comment.