cake-build / cake-build/cake

ProcessRunner needs Redirect Standard Input

Open
#1,480 4 comments 6 reactions 0 assignees View on GitHub
Improvement
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

This might seem like a bit of an unusual request, but `ProcessRunner` needs to implement the ability to redirect stdin. So, `IProcess` needs a `StreamWriter StandardInput { get; }`, and `ProcessSettings` needs a `bool RedirectStandardInput { get;set; }`.

The use case is developing an addin for Android's `sdkmanager` utility. Unfortunately they don't provide a command line argument to accept the license agreement, so we have to pipe in `y\r\n` to stdin in order to accept the license during the process being run.

I've worked around this in my addin by basically subclassing `Tool` and creating my own `RunProcess` method which returns an object with a reference to the stdin stream. Because of the way some members are marked private, I pretty much had to reimplement the whole class (fetching the toolpath, etc).

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing ProcessRunner, IProcess, ProcessSettings, and Tool process-execution paths mentioned in the issue. Verify how standard output and process settings are currently exposed, then identify the relevant existing process tests if available. Done means callers can enable standard-input redirection and write the sdkmanager license response through the returned StandardInput stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.