Skip to content

Easier Way to Read Process Output? #3947

Closed
@devlead

Description

@devlead

Discussed in https://github.com/orgs/cake-build/discussions/3837

Originally posted by RehanSaeed March 10, 2022
I'm executing a process and reading the output like so:

StartProcess(
    "az",
    new ProcessSettings()
        .WithArguments(x => x
            .Append("account")
            .Append("list-locations"))
        .SetRedirectStandardOutput(true),
        out var lines);
var json = string.Join(Environment.NewLine, lines);

This is pretty cumbersome. I'd really like something far simpler like simple-exec built into Cake build aliases so I don't have to include yet another dependency:

var (standardOutput, standardError) = await ReadAsync("az account list-locations");

I don't believe anything like this currently exists unless there is an alias I'm missing?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions