Skip to content

Fix DISM resource input handling - #1741

Merged
Steve Lee (SteveL-MSFT) merged 4 commits into
PowerShell:mainfrom
SteveL-MSFT:stevel-msft-fix-dism-input
Oct 8, 2026
Merged

Steve Lee (SteveL-MSFT) merged 4 commits into
PowerShell:mainfrom
SteveL-MSFT:stevel-msft-fix-dism-input

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

dsc resource export could block when a DISM resource received no filter because dism_dsc attempted to read inherited stdin. This prevented commands such as dsc resource export -r Microsoft.Windows/WindowsFeatureList from enumerating all features.

This change:

  • passes resource JSON through an explicit --input argument for every DISM resource operation
  • keeps export input optional so an omitted filter enumerates all resources
  • keeps get and set input mandatory through their manifest definitions
  • covers filtered and unfiltered exports through dsc.exe for Windows features, optional features, and Features on Demand

Validation:

  • repository build completed successfully
  • targeted DISM export tests complete without blocking; full enumeration requires an elevated test shell

Pass resource JSON through an explicit --input argument so export operations without filters do not block on stdin.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 00:33
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing what-if tests still pipe JSON to dism_dsc and will fail under the new argument-only protocol.

1 open finding
What changed in this PR

Updates DISM resources to pass JSON explicitly, preventing unfiltered exports from blocking on stdin.

Changes:

  • Adds --input manifest arguments for DISM operations.
  • Replaces stdin reading with argument parsing.
  • Updates export tests and usage text.
File Description
resources/​dism_dsc/​src/​main.rs Reads JSON from --input.
resources/​dism_dsc/​locales/​en-us.toml Updates CLI usage text.
resources/​dism_dsc/​windows_feature.dsc.resource.json Configures argument-based input.
resources/​dism_dsc/​optionalfeature.dsc.resource.json Configures argument-based input.
resources/​dism_dsc/​featureondemand.dsc.resource.json Configures argument-based input.
resources/​dism_dsc/​tests/​windowsFeature_export.tests.ps1 Exercises exports through dsc.exe.
resources/​dism_dsc/​tests/​optionalFeature_export.tests.ps1 Exercises exports through dsc.exe.
resources/​dism_dsc/​tests/​featureOnDemand_export.tests.ps1 Exercises exports through dsc.exe.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread resources/dism_dsc/src/main.rs
Steve Lee (POWERSHELL HE/HIM) (from Dev Box) and others added 2 commits October 7, 2026 17:45
Route Windows feature what-if tests through the resource manifest so they validate the --input argument protocol.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Return ExitCode from dism_dsc instead of terminating with process::exit so LLVM coverage profiles are written after Pester invokes the resource. Add focused tests for input argument parsing and dispatch exit codes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SteveL-MSFT
Steve Lee (SteveL-MSFT) merged commit a84f24f into PowerShell:main Oct 8, 2026
20 checks passed
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the stevel-msft-fix-dism-input branch October 8, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants