diff --git a/src/System.CommandLine.Suggest/SuggestionStore.cs b/src/System.CommandLine.Suggest/SuggestionStore.cs index ac93972eb1..f30637d3ad 100644 --- a/src/System.CommandLine.Suggest/SuggestionStore.cs +++ b/src/System.CommandLine.Suggest/SuggestionStore.cs @@ -44,9 +44,13 @@ public string GetCompletions(string exeFileName, string suggestionTargetArgument Task readToEndTask = process.StandardOutput.ReadToEndAsync(); - if (readToEndTask.Wait(timeout)) + if (process.WaitForExit((int)timeout.TotalMilliseconds)) { - result = readToEndTask.Result; + if(process.ExitCode == 0) + { + result = readToEndTask.Result; + } + } else {