procex: Ergonomic process launching with extreme flexibility and speed

[ library, mit, shell, system ] [ Propose Tags ]

procex is a library for launching unix processes, that DOES NOT wrap createProcess. It interfaces directly with vfork and execve, and closes fds efficiently using the new close_range Linux syscall (or close if not available). The syntax for launching processes is clean, concise, and flexible, mimicking sh.


[Skip to Readme]
Versions [RSS] [faq] 0.1.0.0, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1
Change log CHANGELOG.md
Dependencies async (>=2.2.3 && <2.3), base (>=4.14.1 && <4.16), bytestring (>=0.10.12 && <0.12), containers (>=0.6.2 && <0.7), deepseq (>=1.4.4 && <1.5), unix (>=2.7.2 && <2.8), utf8-string (>=1.0.2 && <1.1) [details]
License MIT
Author Las Safin
Maintainer me@las.rs
Category System, Shell
Bug tracker https://github.com/L-as/procex
Source repo head: git clone https://github.com/L-as/procex
Uploaded by las at 2021-08-24T13:43:20Z
Distributions NixOS:0.3.1
Downloads 385 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates


Readme for procex-0.3.1

[back to package description]

Hackage

Hackage documentation

My blog post about using it as a shell (see example-shell directory).

About

procex is a library for launching unix processes, that DOES NOT wrap createProcess. It interfaces directly with vfork and execve, and closes fds efficiently using the new close_range Linux syscall (or close if not available). The syntax for launching processes is clean, concise, and flexible, mimicking sh.

Differences from shh, turtle, etc.

procex can:

  • execve without fork, i.e. replace the current process
  • Set fds besides 0, 1, and 2
  • Launch a process without taking >0.5s when max fds is high
  • Launch processes with an invalid UTF-8 name
  • Be extended easily due to the flexible and simple API
  • Be used as a shell
  • not wrap Haskell functions in a Cmd like shh, because that is generally not a good solution

Example

import Procex.Prelude

main :: IO ()
main = captureLazy (mq "cat" <<< "some stdin") >>= \stdout -> putStrLn (show stdout)

TODO

  • Setting the environment (workaround: use env from coreutils)
  • Better README
  • Support for non-Linux kernels