Skip to content

Support STDIN through SDK - #41698

Merged
Blue (OneBlue) merged 2 commits into
microsoft:masterfrom
JohnMcPMS:add-stdin
Sep 25, 2026
Merged

Blue (OneBlue) merged 2 commits into
microsoft:masterfrom
JohnMcPMS:add-stdin

Conversation

@JohnMcPMS

Copy link
Copy Markdown
Member

Summary of the Pull Request

Add support for STDIN usage through the SDK.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Adds process flags to the C SDK (WslcProcessFlags set via WslcSetProcessSettingsFlags). The only flag supported at this time is the STDIN enabler (WSLC_PROCESS_FLAG_STDIN).

Adds a similar property to the WinRT process settings (EnableStandardInput).

Also updates the docs and fixes an issue in the WinRT stream coroutines (not pinning a parameter used after suspension).

Validation Steps Performed

Added tests for the new flag/property and usage of STDIN.

@JohnMcPMS
JohnMcPMS requested review from a team as code owners September 24, 2026 22:02
Copilot AI lite review requested due to automatic review settings September 24, 2026 22:02

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.

Copilot review overview

🟡 Changes recommended

Fix the ABI layout issue, add direct-process STDIN coverage, and correct the documented timing boundary.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity · 2 Low severity

Open (4)
What changed in this PR

Adds STDIN support to the C and WinRT SDKs, with stream lifetime fixes, tests, and documentation.

Changes:

  • Adds WSLC_PROCESS_FLAG_STDIN and WinRT EnableStandardInput.
  • Propagates STDIN settings to processes and fixes stream buffer lifetime.
  • Adds functional tests and API documentation.

Review findings require changes: the internal options layout breaks ABI compatibility, direct-process STDIN coverage is missing, and timing documentation needs correction.

File Description
test/​windows/​WslcSdkWinRTTests.cpp Tests WinRT STDIN behavior.
test/​windows/​WslcSdkTests.cpp Tests C SDK flags and STDIN.
src/​windows/​WslcSDK/​WslcsdkPrivate.h Stores internal process flags.
src/​windows/​WslcSDK/​wslcsdk.h Defines the public flags API.
src/​windows/​WslcSDK/​wslcsdk.def Exports the new API.
src/​windows/​WslcSDK/​wslcsdk.cpp Validates and propagates flags.
src/​windows/​WslcSDK/​winrt/​wslcsdk.idl Adds the WinRT property.
src/​windows/​WslcSDK/​winrt/​Streams.cpp Preserves buffers across suspension.
src/​windows/​WslcSDK/​winrt/​ProcessSettings.h Declares STDIN state.
src/​windows/​WslcSDK/​winrt/​ProcessSettings.cpp Implements STDIN configuration.
doc/​docs/​api-reference/​csharp/​settings-classes/​processsettings.md Documents the C# setting.
doc/​docs/​api-reference/​csharp/​core-classes/​process.md Documents C# input-stream requirements.
doc/​docs/​api-reference/​cpp/​settings-classes/​processsettings.md Documents the C++ setting.
doc/​docs/​api-reference/​cpp/​core-classes/​process.md Documents C++ input-stream requirements.
doc/​docs/​api-reference/​c/​process-apis/​wslcsetprocesssettingsflags.md Documents the C API.
doc/​docs/​api-reference/​c/​process-apis/​index.md Adds API navigation.
doc/​docs/​api-reference/​c/​process-apis/​.pages Updates API navigation.
doc/​docs/​api-reference/​c/​enumerations/​wslcprocessflags.md Documents process flags.
doc/​docs/​api-reference/​c/​enumerations/​index.md Adds enum navigation.
doc/​docs/​api-reference/​c/​enumerations/​.pages Updates enum navigation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/windows/WslcSDK/WslcsdkPrivate.h
Comment on lines +1351 to +1352
VERIFY_SUCCEEDED(WslcSetProcessSettingsCmdLine(&procSettings, argv, ARRAYSIZE(argv)));
VERIFY_SUCCEEDED(WslcSetProcessSettingsFlags(&procSettings, WSLC_PROCESS_FLAG_STDIN));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agreed with this

Comment thread src/windows/WslcSDK/wslcsdk.h

@OneBlue Blue (OneBlue) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, feel free to resolve the two minor comments in a followup

Comment thread src/windows/WslcSDK/wslcsdk.h
Comment thread src/windows/WslcSDK/wslcsdk.cpp
Comment thread src/windows/WslcSDK/winrt/ProcessSettings.cpp
@JohnMcPMS

Copy link
Copy Markdown
Member Author

LGTM, feel free to resolve the two minor comments in a followup

Feel free to merge it if it is done before I see it. I will do a followup.

@OneBlue
Blue (OneBlue) merged commit 855ae78 into microsoft:master Sep 25, 2026
11 checks passed
@JohnMcPMS
JohnMcPMS deleted the add-stdin branch September 25, 2026 16:42
@JohnMcPMS JohnMcPMS mentioned this pull request Sep 25, 2026
3 of 6 tasks
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.

4 participants