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.
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
Invoke ShellExecute on dism.exe for enabling Windows Features #3659
Invoke ShellExecute on dism.exe for enabling Windows Features #3659
Changes from 4 commits
12e3931
0750b0d
7950e70
fa2f58e
6396bf8
b316b9c
f66cb38
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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: there is a GetExpandedPath function in winget/Filesystem.cpp which is specifically created for getting an expanded path
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.
Changed to calling GetExpandedPath from Filesystem.h
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: should we use the pointer pattern for this one and below like other test hooks so the codes have consistency?
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.
There is another test hook that also passes an optional value like so:
void TestHook_SetPinningIndex_Override(std::optional<std::filesystem::path>&& indexPath);
Since I am also passing an optional DWORD value, I just did something similar to that.
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.
I think we should keep this ApplyToType part in DependenciesFLow.cpp so all dependencies related logic are in that flow. ShellExecuteInstallerHandler.cpp will only expose EnableWindowsFeature flow for enabling only 1 feature, so in the future if we are to implement winget features --enable --disable, we can reuse the same code.
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.
I moved the ApplyToType part back to the DependenciesFlow as suggested. I created a separate workflow just for enabling a single feature that way it can be reused in the future.
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.
result does not seem to be an HResult, we would not use FAILED to check non hresult type
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.
I replaced the FAILED(result) check with a boolean value that is only set to true if we encounter an error. Since there are only a few error codes that we are looking for that change our output behavior to the user, I felt that this was an easier approach rather than checking for failed exit codes.