throw on exceeding timeout

This commit is contained in:
Volodymyr Smirnov 2020-10-28 08:32:19 +02:00
parent 3a57427135
commit 9afbabfb4d

View File

@ -46,8 +46,12 @@ namespace MalwareMultiScan.Backends.Backends.Abstracts
cancellationToken.Register(() => cancellationToken.Register(() =>
{ {
if (!process.HasExited) if (process.HasExited)
process.Kill(true); return;
process.Kill(true);
throw new TimeoutException("Scanning failed to complete within the timeout");
}); });
process.WaitForExit(); process.WaitForExit();