Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/Verify.ClipboardAccept/ClipboardAccept.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,28 @@ static async Task Append(string command)
try
{
builder.AppendLine(command);
await ClipboardService.SetTextAsync(builder.ToString());
await SetClipboardText(builder.ToString());
}
finally
{
semaphore.Release();
}
}

static async Task SetClipboardText(string text)
{
try
{
await ClipboardService.SetTextAsync(text);
}
catch (Exception exception)
{
// This runs from the OnFirstVerify and OnVerifyMismatch callbacks, which the
// engine awaits while building the failure. Letting a clipboard failure out
// replaces the snapshot diff with an unrelated error: no xsel or wl-copy on a
// headless Linux box, or another process holding the Windows clipboard.
// Copying the accept command is a convenience, so it fails quietly.
Trace.WriteLine($"Verify: could not write the accept command to the clipboard. {exception}");
}
}
}
Loading