Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SuggestionStore::GetCompletions to check exit code of invoked applica…#2160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
baradgur wants to merge6 commits intodotnet:main
base:main
Choose a base branch
Loading
frombaradgur:issue-2137

Conversation

@baradgur
Copy link

Thisfixes#2137.

@baradgur
Copy link
Author

@dotnet-policy-service agree

Task<string>readToEndTask=process.StandardOutput.ReadToEndAsync();

if(readToEndTask.Wait(timeout))
if(readToEndTask.Wait(timeout)&&process.HasExited&&process.ExitCode==0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Theelse block might need some additional checks as well. It doesn't appear that we have code coverage over both of these code branches.

Task<string>readToEndTask=process.StandardOutput.ReadToEndAsync();

if(readToEndTask.Wait(timeout))
if(readToEndTask.Wait(timeout)&&process.HasExited&&process.ExitCode==0)

Choose a reason for hiding this comment

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

I'm not sure this is entirely reliable. If the child process first closes its standard output and then exits, thenreadToEndTask.Wait might complete whileprocess.HasExited is still false. And maybe that can even happen if the child process does not intentionally delay exiting. It might be more reliable to also call Process.WaitForExit(TimeSpan) with a small grace period.

@baradgur
Copy link
Author

baradgur commentedApr 12, 2023
edited
Loading

I saw the issue yesterday and that is why th PR is not marked as ready for review yet. Sorry for confusion, I will fix and test this today. Thanks for the feedback


namespaceSystem.CommandLine.Suggest.Tests;

[Collection("TestsWithTestApps")]
Copy link
Author

Choose a reason for hiding this comment

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

Note: this attribute is inherited, so both SuggestionStoreTests and DotnetSuggestEndToEndTests will run in the same collection, meaning - not in parallel. This allows the gracefull cleanup of TestsApp files.

Copy link
Author

Choose a reason for hiding this comment

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

Not sure whether that solution with the faulted console app was the right way, honestly.

if(process.WaitForExit(timeout)&&process.ExitCode==0)
{
result=readToEndTask.Result;
result=process.StandardOutput.ReadToEnd();

Choose a reason for hiding this comment

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

This might wait beyond the timeout, if the child process exited but a grandchild process is still holding the pipe open.

{
if(eventArgs.Data!=null)
{
stringBuilder.AppendLine(eventArgs.Data);
Copy link

@KalleOlaviNiemitaloKalleOlaviNiemitaloApr 14, 2023
edited
Loading

Choose a reason for hiding this comment

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

Should be just Append, not AppendLine.
There may be a thread safety problem if there is still more data coming in during thestringBuilder.ToString() call; although the child process has exited, grandchild processes might still write to the pipe.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you, might be the mistake is here! I hope it is my last. Otherwise I am completely at loss right now on why the test keeps faling.
Regarding Append/AppendLine: seems not the case here - I have tested it, the eventArgs.Data comes without any line terminator.

@baradgur
Copy link
Author

baradgur commentedApr 16, 2023
edited
Loading

Can I do a diagnostic commit (e.g. add some messages) and revert it later? Is this allowed? The test is failing and I unfortunately have no means to identify the reason.
Locally all tests work.

@jonsequitur
Copy link
Contributor

@baradgur Here's the output from the failing test. I've triggered another run to see if it's consistent.

image

@baradgur
Copy link
Author

@jonsequitur Thanks, I saw this one :) My trouble is - I cannot reproduce the issue on my side no matter what I try. If you can offer some thoughts about this, I would be grateful.
My current plan is to configure gihub actions on a separate branch (or even repo, not sude wheter github allows actions on a fork) to run tests on the machine with the same configuration as the build machine (e.gubuntu one) and add some robust logging to diagnose the issue.

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

Reviewers

@jonsequiturjonsequiturjonsequitur approved these changes

+1 more reviewer

@KalleOlaviNiemitaloKalleOlaviNiemitaloKalleOlaviNiemitalo left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

GetCompletions should check exit code of invoked application

3 participants

@baradgur@jonsequitur@KalleOlaviNiemitalo

[8]ページ先頭

©2009-2025 Movatter.jp