procex: Ergonomic process launching with extreme flexibility and speed

[ library, mit, shell, system ] [ Propose Tags ] [ Report a vulnerability ]

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]

Flags

Manual Flags

NameDescriptionDefault
develop

develop

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1, 0.3.2, 0.3.3
Change log CHANGELOG.md
Dependencies async (>=2.2.3 && <2.3), base (>=4.14.1 && <5), bytestring (>=0.10.12 && <0.12), containers (>=0.6.2 && <0.7), deepseq (>=1.4.4 && <1.5), unix (>=2.7 && <2.9), 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 2022-08-29T12:39:40Z
Distributions NixOS:0.3.3
Downloads 1083 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-08-29 [all 1 reports]

Readme for procex-0.3.3

[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