Skip to content

Commit

Permalink
Allow disabling timeouts selectively without having to debug
Browse files Browse the repository at this point in the history
Fixes #38
  • Loading branch information
kzu committed Aug 23, 2022
1 parent 9644969 commit bca8469
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Xunit.Vsix/TaskExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ static class TaskExtensions
{
public static async Task<T> TimeoutAfter<T>(this Task<T> task, int millisecondsTimeout)
{
var timeout = bool.TryParse(Environment.GetEnvironmentVariable(Constants.DebugTimeoutsEnvironmentVariable), out var shouldTimeout) && shouldTimeout;
var disableTimeout = bool.TryParse(Environment.GetEnvironmentVariable(Constants.DisableTimeoutsEnvironmentVariable), out var noTimeout) && noTimeout;
// Never timeout if a debugger is attached.
if (Debugger.IsAttached && timeout != true)
if (Debugger.IsAttached || disableTimeout == true)
return await task;

if (task == await Task.WhenAny(task, Task.Delay(millisecondsTimeout)))
Expand Down

0 comments on commit bca8469

Please sign in to comment.