private static async Task <List <string> > runDockerCommandWithOutputAsync(string args, int timeout = 10000, CancellationToken cancellationToken = default) { var command = CommandInfo.DockerCommand(args); var processPayload = new ProcessPayload(); var final = new List <string>(); var processTask = OperationSystemService.RunCommandAsync(command, processPayload, tempLogDir(), null, log: false, outputReceived: line => final.Add(line), cancellationToken: cancellationToken); await Task.WhenAny(processTask, Task.Delay(timeout, cancellationToken)); processPayload.Kill(); return(final.ToListThreadSafe()); }
private static Task runDockerCommandAsync(string args, bool log, CancellationToken cancellationToken = default) { var command = CommandInfo.DockerCommand(args); return(OperationSystemService.RunCommandAsync(command, new ProcessPayload(), tempLogDir(), null, log: log, cancellationToken: cancellationToken)); }