-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add ProcessOutputLine struct and Process.ReadAllLinesAsync #126987
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+512
−1
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0aaadbc
Add ProcessOutputLine struct and Process.ReadAllLinesAsync method
Copilot 0c86843
Fix drain logic to use isError tracking instead of stale task variables
Copilot a29272a
Address review feedback: sort ReadAllLinesAsync alphabetically in ref…
Copilot a79f653
Add null validation, linked CTS for early stop, stderr priority docs,…
Copilot f919955
Add clarifying comment for observed task exception handling in finall…
Copilot c305684
Rewrite ReadAllLinesAsync using Channel-based approach and fix ref st…
Copilot 7bb5258
Address MihaZupan's review: bool firstCompleted, Cancel(), WaitToRead…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessOutputLine.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace System.Diagnostics | ||
| { | ||
| /// <summary> | ||
| /// Represents a single line of text read from a process's standard output or standard error stream. | ||
| /// </summary> | ||
| public readonly struct ProcessOutputLine | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ProcessOutputLine"/> struct. | ||
| /// </summary> | ||
| /// <param name="content">The text content of the output line.</param> | ||
| /// <param name="standardError"> | ||
| /// <see langword="true" /> if the line was read from standard error; | ||
| /// otherwise, <see langword="false" />. | ||
| /// </param> | ||
| public ProcessOutputLine(string content, bool standardError) | ||
| { | ||
| Content = content ?? throw new ArgumentNullException(nameof(content)); | ||
| StandardError = standardError; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the text content of the output line. | ||
| /// </summary> | ||
| public string Content { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets a value that indicates whether the line was read from standard error. | ||
| /// </summary> | ||
| /// <value> | ||
| /// <see langword="true" /> if the line was read from standard error; | ||
| /// otherwise, <see langword="false" />. | ||
| /// </value> | ||
| public bool StandardError { get; } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.