Coder Social home page Coder Social logo

Comments (6)

paf31 avatar paf31 commented on August 16, 2024

What about

data StdIOBehaviour r eff = ShareStream (Stream r eff) | [...]

and then specifying r depending on the particular stream (stdin etc.) and propagating eff to the FFI definitions which use the options object?

from purescript-node-child-process.

hdgarrood avatar hdgarrood commented on August 16, 2024

I can't see how to make that work well, because different StdIOBehaviour values corresponding to different streams all have to go into an array together, and often these different streams have different values for r (in particular, stdin, stdout, and stderr often appear there together); relevant docs: https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio

I'm not all that keen on propagating effect rows here either, because then you'd have to make sure they line up when you use spawn and that might be a pain, but also if you're creating child processes the compiler isn't going to be able to tell you what effects that might cause, so I'm not sure effect tracking is going to pay off here.

from purescript-node-child-process.

paf31 avatar paf31 commented on August 16, 2024

On the array side, you could replace it with a record, since there are always three things in the array, right?

from purescript-node-child-process.

hdgarrood avatar hdgarrood commented on August 16, 2024

I don't think there necessarily are, at least node seems to happily spawn things if I specify stdio: [] or stdio: ['pipe']. Although perhaps leaving them out is the same as passing null, so I'd guess [] means the same as [null,null,null] and ['pipe'] means the same as ['pipe',null,null]. There are sometimes more than three things in the array, too.

from purescript-node-child-process.

hdgarrood avatar hdgarrood commented on August 16, 2024

Effect simplifies this :)

from purescript-node-child-process.

JordanMartinez avatar JordanMartinez commented on August 16, 2024

This has been resolved in the new way of handling stdio via the safe ChildProcess and the unsafe UnsafeChildProcess.

from purescript-node-child-process.

Related Issues (11)

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.