Skip to content

Commit

Permalink
Keep a buffer of the logs to check when waiting for text in the log o…
Browse files Browse the repository at this point in the history
…utput. (#6)
  • Loading branch information
annymsMthd authored Dec 10, 2016
1 parent 8dd44ea commit 369c170
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/LclDckr/DockerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,17 @@ public async Task WaitForLogEntryAsync(string container, string desiredLog, Time

var timeoutTask = Task.Delay(timeout);

StringBuilder logBuffer = new StringBuilder();
process.OutputDataReceived += (_, eventArgs) =>
{
if (eventArgs.Data == null)
{
return;
}
if (eventArgs.Data.Contains(desiredLog))

logBuffer.Append(eventArgs.Data);

if (logBuffer.ToString().Contains(desiredLog))
{
tcs.TrySetResult(true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/LclDckr/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.3-*",
"version": "1.0.4-*",
"description": "A dotnet wrapper around the docker cli.",
"authors": ["Syncromatics"],
"packOptions": {
Expand Down
2 changes: 1 addition & 1 deletion test/LclDckr.IntegrationTests/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.3-*",
"version": "1.0.4-*",
"testRunner": "xunit",
"dependencies": {
"xunit": "2.2.0-beta4-build3444",
Expand Down

0 comments on commit 369c170

Please sign in to comment.