From 9b2e6efcbd8194886e614df9f6581ca3c69f1070 Mon Sep 17 00:00:00 2001 From: "Omid K. Rad" Date: Thu, 25 Jul 2024 15:06:42 -0700 Subject: [PATCH] Avoid IOException when log file is in use --- QuantConnect.IBAutomater/IBAutomater.cs | 9 ++++++++- QuantConnect.IBAutomater/QuantConnect.IBAutomater.csproj | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/QuantConnect.IBAutomater/IBAutomater.cs b/QuantConnect.IBAutomater/IBAutomater.cs index 990f50a..222517d 100644 --- a/QuantConnect.IBAutomater/IBAutomater.cs +++ b/QuantConnect.IBAutomater/IBAutomater.cs @@ -268,7 +268,14 @@ public StartResult Start(bool waitForExit) { if (File.Exists(_ibGatewayLogFileName)) { - File.Delete(_ibGatewayLogFileName); + try + { + File.Delete(_ibGatewayLogFileName); + } + catch (IOException ex) + { + + } } } diff --git a/QuantConnect.IBAutomater/QuantConnect.IBAutomater.csproj b/QuantConnect.IBAutomater/QuantConnect.IBAutomater.csproj index 29e85bc..f8660a4 100644 --- a/QuantConnect.IBAutomater/QuantConnect.IBAutomater.csproj +++ b/QuantConnect.IBAutomater/QuantConnect.IBAutomater.csproj @@ -22,7 +22,7 @@ - - + + \ No newline at end of file