-
Notifications
You must be signed in to change notification settings - Fork 256
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
Support rsp in MTP #4072
base: main
Are you sure you want to change the base?
Support rsp in MTP #4072
Conversation
8ee8e46
to
41d38e8
Compare
41d38e8
to
fce6c4b
Compare
src/Platform/Microsoft.Testing.Platform/CommandLine/ResponseFileHelper.cs
Outdated
Show resolved
Hide resolved
new("option4", ["d"]), | ||
new("option5", ["e"]), | ||
new("option6", ["f"]), | ||
}.ToArray(), [])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add a pair of more sample with
- rsp file at the start
- rsp file t the end
- only rsp file
- 2 rsp file only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// - https://github.com/dotnet/command-line-api/blob/feb61c7f328a2401d74f4317b39d02126cfdfe24/src/System.CommandLine/Parsing/StringExtensions.cs#L349 | ||
internal static class ResponseFileHelper | ||
{ | ||
internal static bool TryReadResponseFile(string rspFilePath, List<string> errors, [NotNullWhen(true)] out string[]? newArguments) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: let's use higher abstraction for errors.
internal static bool TryReadResponseFile(string rspFilePath, List<string> errors, [NotNullWhen(true)] out string[]? newArguments) | |
internal static bool TryReadResponseFile(string rspFilePath, ICollection<string> errors, [NotNullWhen(true)] out string[]? newArguments) |
newArguments = null; | ||
return false; | ||
|
||
static IEnumerable<string> ExpandResponseFile(string filePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stylistic nit:
static IEnumerable<string> ExpandResponseFile(string filePath) | |
// Local functions | |
static IEnumerable<string> ExpandResponseFile(string filePath) |
|
||
static IEnumerable<string> ExpandResponseFile(string filePath) | ||
{ | ||
string[] lines = File.ReadAllLines(filePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be worth reading async (cc @MarcoRossignoli)?
} | ||
catch (IOException e) | ||
{ | ||
errors.Add(string.Format(CultureInfo.InvariantCulture, PlatformResources.CommandLineParserFailedToReadResponseFile, rspFilePath, e.Message)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding the tostring of the exception.
Fixes #3730