Skip to content

API for processes #1080

@jiribenes

Description

@jiribenes

I'd like there to be an API that can spawn processes similarly to popen(3) / subprocess.run.

The high-level API would be something like:

import process

process::spawn("cp", ["from.txt", "to.txt"]) // : ???

There are two main questions:

  1. How to actually implement this / what properties do we want?

Should spawn only return the process ID? What would be the callback when the command gets run? Is it (a-)synchronous?

NodeJS has child_process[.spawn] for this, libuv (for the LLVM backend) has spawn. It's necessary to have such an API that works on both the [Node.]JS and the LLVM backends.

  1. How do we communicate with the process?

In simpler terms, how do we get the stdin/stdout/stderr of the new process?
Can/should it be streaming? How do we process failures (exit = 1) and return codes in general? Can we do something with signals? IPC?...

Metadata

Metadata

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions