From c78c1a7d7fa1947bc13baf246ba5fcd1530f4c8a Mon Sep 17 00:00:00 2001 From: pinzart Date: Tue, 28 Nov 2023 15:22:04 -0500 Subject: [PATCH] update --- src/DynamoUtilities/CLIWrapper.cs | 5 +++-- src/DynamoUtilities/DynamoFeatureFlagsManager.cs | 2 +- src/DynamoUtilities/Md2Html.cs | 6 ++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/DynamoUtilities/CLIWrapper.cs b/src/DynamoUtilities/CLIWrapper.cs index 5578e233867..b6040df6a1b 100644 --- a/src/DynamoUtilities/CLIWrapper.cs +++ b/src/DynamoUtilities/CLIWrapper.cs @@ -97,7 +97,7 @@ protected static string GetToolPath(string relativePath) /// /// will return empty string if we don't finish reading all data in the timeout provided in milliseconds. /// - protected virtual async Task GetData(int timeoutms) + protected virtual string GetData(int timeoutms) { var readStdOutTask = Task.Run(() => { @@ -145,7 +145,8 @@ protected virtual async Task GetData(int timeoutms) return writer.ToString(); } }); - var completedTask = await Task.WhenAny(readStdOutTask, Task.Delay(TimeSpan.FromMilliseconds(timeoutms))); + + var completedTask = Task.WhenAny(readStdOutTask, Task.Delay(TimeSpan.FromMilliseconds(timeoutms))).Result; //if the completed task was our read std out task, then return the data //else we timed out, so return an empty string. return completedTask == readStdOutTask ? readStdOutTask.Result : string.Empty; diff --git a/src/DynamoUtilities/DynamoFeatureFlagsManager.cs b/src/DynamoUtilities/DynamoFeatureFlagsManager.cs index d60c886c7c9..de0614bedff 100644 --- a/src/DynamoUtilities/DynamoFeatureFlagsManager.cs +++ b/src/DynamoUtilities/DynamoFeatureFlagsManager.cs @@ -64,7 +64,7 @@ internal void CacheAllFlags() { //wait for response - var dataFromCLI = GetData(featureFlagTimeoutMs).Result; + var dataFromCLI = GetData(featureFlagTimeoutMs); //convert from json string to dictionary. try { diff --git a/src/DynamoUtilities/Md2Html.cs b/src/DynamoUtilities/Md2Html.cs index ceb5908b2a7..532a3268fc1 100644 --- a/src/DynamoUtilities/Md2Html.cs +++ b/src/DynamoUtilities/Md2Html.cs @@ -73,9 +73,7 @@ internal string ParseMd2Html(string mdString, string mdPath) return GetCantCommunicateErrorMessage(); } - var output = GetData(processCommunicationTimeoutms); - - return output.Result; + return GetData(processCommunicationTimeoutms); } /// @@ -104,7 +102,7 @@ internal string SanitizeHtml(string content) var output = GetData(processCommunicationTimeoutms); - return output.Result; + return output; } ///