Giter Club home page Giter Club logo

deno-proc's People

Contributors

j50n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

deno-proc's Issues

Rework API

I have some ideas for reworking the API so it is a lot more intuitive than the current one - and also covers more use cases. This ticket is for the feature branch, as this is going to break stuff, and I want to make sure it is ready before I push it out.

A Compelling Example for the README

I need to find a good example for the README. I would like it to demonstrate piping bytes and processing string data, but be simple enough to read. It would be good if there were an analogous bash script to compare it to. Might be good to use stdin for input as well.

Optional Chained Errors

Chained Errors should be optional, as they are a bit harder to deal with in production code, but can be useful during debugging.

Auto process close should remove process from ProcGroup.

When the outputs of a process have been completely consumed, the process and its resources are closed automatically. At this point, we won't need to close them again, so we can remove their references in the associated ProcGroup.

This covers the case where someone uses a single ProcGroup to run lots of processes without closing.

Support for Tee

Deno has a "tee" mechanism. Let's embed that into this and make it simple to use.

Line Separators Must Honor the OS

Current line separators are hard coded to "\n" in some places. These need to be changed to recognize the OS and use the appropriate line ending.

Support Iterables for Input and Output

We have support for arrays and AsyncIterables, but not for Iterables. It seems like there should be handlers specifically for Iterable, just for the sake of completeness.

Intermittent Failing Tests

Separation of error propagation logic from data pump seems to be causing a race condition where occasionally one of the error tests will fail. I think I need a redesign to use a queuing strategy. That would probably clean up a lot of incidental complexity as well, but is a lot of rework.

Match Buffer Sizes

Inspect the Deno source and make sure we are using the correct buffer size for transferring data.

Simple Runner

I'd like to be able to shadow-run a process, sending stderr to Deno stderr and stdout to Deno stdout, and no stdin. This is a common use case for running CI/CD processes.

I would also like to be able to decorate the outputs with color and time, and perhaps a label.

Kill?

A good evening project.

Check out some standard signals and write some tests. It probably does not work as expected in its current form.

What to Do With Stderr?

I am currently just inheriting.

Callers may want to suppress, scrape, or redirect. Need to work out various use cases and develop tests for each.

String Iterable Performance

Something is wrong with string Iterables. I am getting 50,000 to 100,000 lines per second peak performance on very small lines. It seems like the overhead per line should be much lower than 200usec per line.

I need to do some profiling to figure out where the performance hit is happening.

Support Worker Processes

I need a way to support passing messages from the stdin side of the process so that I can implement persistent worker processes.

Default Global Group

Modify the API to allow no group to be defined. In this case, a global group will be used. This works fine for processes that clean up correctly and for short runs. With that boilerplate gone, it feels a lot more like an extended bash script.

Add Alternate Error Processing

Current error processing is baked in. In a few cases, we don't want to throw an error on non-zero exit codes, and it may be desirable to control the error that is thrown.

This will be implemented as another function you can pass along with the alternate stderr handler function. This does not break backwards compatibility of the API.

Also, note that an error can already be thrown from the stderr handler.

This should all be documented.

Return Better Iterables

I'd like to be able to use map and filter without wrapping with asynciter, and I would also like to be able to run another process from the output of a process.

Resource Leak on Error

I cannot fix this immediately, so I am going to hang on to this and keep an eye on the related ticket for a while.

May be related to Aborting a CompressionStream/DecompressionStream leaks a resource #14212.

I have tried several ways to inject the ExitCodeError of the process into the
stream, including using flush of TransformStream. I settled on converting
the stream to AsyncIterableIterator, throwing the error after the stream had
been fully processed, and then converting all that back to ReadableStream -
because that mechanism is conceptually straightforward and should just work.

The error:

 ERRORS 

Non-zero exit code => ./tests/exitcode-errors/errors-1.test.ts:4:6
error: Leaking resources:
  - A text decoder (rid 5) was created during the test, but not finished during the test. 
    Close the text decoder by calling `textDecoder.decode('')` or `await textDecoderStream.readable.cancel()`.

The error is being suppressed where it occurs using:

sanitizeResources: false,

in the test definition.

Deno Command Rework

Deno has deprecated Deno.run in favor of a new API, Deno.Command, which is in many ways a major improvement over the old API. It is, however, quite a disruptive redesign.

I have been meaning to look at simplifying my own API. Perhaps this is the time.

I am going to attempt a redo with the idea that I can make this a lot easier. Let's see how it goes.

stderr Processing Change to AsyncIterator<Uint8Array>

The stderr processing function needs to pass bytes, not strings. This is because passing strings means we are buffering until a linefeed, which works for some output but not others. The default implementation should just write the bytes to stderr as they are read.

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.