diff --git a/src/SmiServices/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiser.cs b/src/SmiServices/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiser.cs index 9bb84923b..46350e91c 100644 --- a/src/SmiServices/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiser.cs +++ b/src/SmiServices/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiser.cs @@ -43,7 +43,10 @@ public SmiCtpAnonymiser(GlobalOptions globalOptions) while (_ctpProcess.StandardOutput.ReadLine() != "READY") { } }); if (!readyTask.Wait(TimeSpan.FromSeconds(5))) + { + _ctpProcess.Dispose(); throw new Exception($"Did not receive READY before timeout. Stderr: {_ctpProcess.StandardError.ReadToEnd()}"); + } } public ExtractedFileStatus Anonymise(IFileInfo sourceFile, IFileInfo destFile, string modality, out string? anonymiserStatusMessage)