Conversation

andyleejordan

It wasn't the module import that was being noisy but the next command. It sure looked like the last commit "fixed" it in testing because the output was certainly silenced...but that was actually due to the side effect of having added an AddScript to the PSCommand causing it to no longer return the imported module at all. Without that return value, the noisy code wasn't executing either. Now the progress preference is saved, set to silent, Get-DscResource is run (silently) and then the preference is restored. Double-checked in the debugger.

@andyleejordanandyleejordan requested a review from a team September 20, 2023 00:59
@andyleejordan

This is a redo of #2068 which didn't quite work as expected.

It wasn't the module import that was being noisy but the next command.
It sure looked like the last commit "fixed" it in testing because the
output was certainly silenced...but that was actually due to the side
effect of having added an `AddScript` to the `PSCommand` causing it to
no longer return the imported module at all. Without that return value,
the noisy code wasn't executing either. Now the progress preference is
saved, set to silent, `Get-DscResource` is run (silently) and then the
preference is restored. Double-checked in the debugger.
@andyleejordanandyleejordan force-pushed the andyleejordan/actually-fix-dsc-output branch from 7ac9fe7 to 88c7521 Compare September 27, 2023 22:36

Choose a reason for hiding this comment

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

LGTM!

@andyleejordanandyleejordan added this pull request to the merge queue Sep 28, 2023
@github-merge-queue-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 28, 2023
@andyleejordanandyleejordan added this pull request to the merge queue Sep 28, 2023
Merged via the queue into main with commit ee5194f Sep 28, 2023
@andyleejordanandyleejordan deleted the andyleejordan/actually-fix-dsc-output branch September 28, 2023 19:50
Sign up for free to join this conversation on . Already have an account? Sign in to comment
Area-Debugging Issue-BugA bug to squash.
Status: Done

Successfully merging this pull request may close these issues.