Skip to content

Commit

Permalink
fix: Check if console input is redirected before reading
Browse files Browse the repository at this point in the history
  • Loading branch information
WillSoss committed Nov 20, 2023
1 parent c8d0c57 commit 0f5b1f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Runly/Hosting/RunAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public async Task RunAsync(CancellationToken token)
{
Console.Write($"\rRunning {execution.Job.GetType().Name}: {execution.CompletedItemCount} items{(execution.TotalItemCount.HasValue ? " of " + execution.TotalItemCount.Value : string.Empty)} processed. {(!jobCancellation.IsCancellationRequested ? "Press 'q' to quit." : "Quitting... ")}");

while (!jobCancellation.IsCancellationRequested && Console.KeyAvailable)
while (!jobCancellation.IsCancellationRequested && !Console.IsInputRedirected && Console.KeyAvailable)
{
var key = Console.ReadKey();

Expand Down

0 comments on commit 0f5b1f4

Please sign in to comment.