Skip to content

Commit 3f7411e

Browse files
Update dotnet/src/webdriver/Firefox/FirefoxDriverService.cs
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
1 parent b02fae8 commit 3f7411e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

dotnet/src/webdriver/Firefox/FirefoxDriverService.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,21 @@ private static string FirefoxDriverServiceFileName()
345345

346346
private async Task ReadStreamAsync(StreamReader reader)
347347
{
348-
string? line;
349-
while ((line = await reader.ReadLineAsync()) != null)
348+
try
350349
{
351-
if (logWriter != null)
350+
string? line;
351+
while ((line = await reader.ReadLineAsync()) != null)
352352
{
353-
logWriter.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} {line}");
353+
if (logWriter != null)
354+
{
355+
logWriter.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} {line}");
356+
}
354357
}
355358
}
359+
catch (Exception ex)
360+
{
361+
// Log or handle the exception appropriately
362+
System.Diagnostics.Debug.WriteLine($"Error reading stream: {ex.Message}");
363+
}
356364
}
357365
}

0 commit comments

Comments
 (0)