Skip to content

Some suggestions #2

Closed
Closed
@hdgarrood

Description

@hdgarrood

I would like to extract the code that deals with Node's child_process module from Pulp (which I recently ported to PureScript) into a separate library, and so this is the obvious candidate, but I don't think it's completely suitable as it currently is. How would you feel about the following:

  • the env option in a SpawnOptions record might be better typed as StrMap String, because currently, each property could be any type, but they should only be String, I think.
  • Also, it would be useful to make the env option Nullable, as the Node API allows you to pass null to inherit the parent's environment.
  • Using a record type for ChildProcess is perhaps a bit unsafe, as we probably shouldn't allow updating of its fields. How about having a newtype without exporting the constructor, and then export functions to access those fields?
  • gid, uid, and pid should probably be Int, not Number.
  • Reading mutable state of a child process, eg connected, should probably require Eff.
  • Do we gain from having a separate effect for each of stderr, stdin, stdout? How about just using Spawn for these too?
  • Using Array String for the stdio option is a little limiting, as the Node API allows you to pass other things instead of strings too, like streams or file descriptors. Also, in the case where you are passing a string, there are a specific set of valid values. We could just use Foreign here, or try to define a sum type, like I did in Pulp.

I would very happily send a PR with these things, if you agree. Also it might be nice to put this under purescript-node and/or publish it to Bower? If maintenance burden is an issue I'd happily take some of that on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions