Skip to content

Fix exit code handling in GetCompletions method to ensure correct res…#2807

Open
AhmedMyoussif wants to merge 2 commits into
dotnet:mainfrom
AhmedMyoussif:fix/exit-code-2137
Open

Fix exit code handling in GetCompletions method to ensure correct res…#2807
AhmedMyoussif wants to merge 2 commits into
dotnet:mainfrom
AhmedMyoussif:fix/exit-code-2137

Conversation

@AhmedMyoussif
Copy link
Copy Markdown

Closes #2137

Summary of Changes

  • Reverted the synchronous event-based approach from previous attempts to use the stable StreamReader via ReadToEndAsync().
  • Used process.WaitForExit(timeout) to ensure that the process and any potential grandchild processes completely close and flush their pipes, addressing the race conditions / thread-safety concerns mentioned in SuggestionStore::GetCompletions to check exit code of invoked applica… #2160.
  • Verified that process.ExitCode == 0 before assigning the suggestions to the result string.

{
result = readToEndTask.Result;
}
result = readToEndTask.Result;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should now be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Thank you for catching it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetCompletions should check exit code of invoked application

2 participants