Code Monkey home page Code Monkey logo

processx's People

Contributors

bbarry avatar guitarrapc avatar mataness avatar mayuki avatar neuecc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

processx's Issues

Reading large byte data

I'm trying to call process that for example compresses large data or does some video processing. This process outputs large stream of data that I would like to process it in C# ideally as some sort of a stream.

Is there a way to achieve this in ProcessX or is it something where I have should go to .NET Process class and read standard output myself?

Is there anyway to set acceptable exit code?

I have a 3rd party executable that returns 1 when it completes successfully.
And because of ExitCode=1, ProcessX throws ProcessErrorException.
I can handle this situation by try-catch, but I'm happy if there is a way to set "acceptable" ExitCode.

Add standard error redirect option

Currently(rev: 09f95cb), ProcessX.StartAsync throws error when process output stderr.
This may be unexpected result in apps using stderr as logging or progress.

So I propose adding option to redirecting stderr.
In particular, add System.IO.Stream or System.Buffers.IBufferWriter<byte>(or char?) to ProcessX.StartAsync API

issue with newlines in commands

I'm writing a script to auto-setup a git repo (converted from an old bash script), and I noticed when I create a multi-line commit message, ProcessX messes up newlines.

Repro:

const string path = "debugMultiline";
await $"git init {path}";
await $"cd {path}";
await "git commit --allow-empty -m \"initial commit\"";
await "git commit --allow-empty -m \"await multi\nline\"";
System.Diagnostics.Process.Start("git", "commit --allow-empty -m \"Process.Start multi\nline\"");
await Cysharp.Diagnostics.ProcessX.StartAsync("git commit --allow-empty -m \"ProcessX.Start multi\nline\"").WriteLineAllAsync();

output:

[main b0ec9e6] initial commit
[main e7fdefa] await multi
[main a6db33f] Process.Start multi line
[main 7603f25] ProcessX.Start multi line

You can tell right away in the output that the second commit message is truncated (missing trailing "line"), which can be double-checked in a any git client).
Process.Start doesn't have that issue (3rd commit), nor does ProcessX.Start (4th commit).

I'm using the latest version (1.5.5) of the Nuget package.

Exception when running with ToTask()

When I run this line:

            var psi = CreateStartInfo(...);

            var lines = await Cysharp.Diagnostics.ProcessX
                .StartAsync(psi)
                .ToTask(token);            

            var text = string.Join("\r\n", lines);

I get this exception:

Cysharp.Diagnostics.ProcessErrorException : Process returns error, ExitCode:0
AsyncOperation`1.GetResult(Int16 token)
ProcessAsyncEnumerator.MoveNextAsync()
ProcessAsyncEnumerable.ToTask(CancellationToken cancellationToken)
ProcessAsyncEnumerable.ToTask(CancellationToken cancellationToken)
...

When calling syncronously, everything works fine.

Steps to reproduce:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.