https://github.com/L-as/procex
Ergonomic process launching with extreme flexibility and speed (compared to shh)
https://github.com/L-as/procex
haskell shell
Last synced: 10 months ago
JSON representation
Ergonomic process launching with extreme flexibility and speed (compared to shh)
- Host: GitHub
- URL: https://github.com/L-as/procex
- Owner: L-as
- License: mit
- Created: 2021-07-14T22:05:28.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-29T17:08:15.000Z (10 months ago)
- Last Synced: 2025-03-29T18:22:06.147Z (10 months ago)
- Topics: haskell, shell
- Language: Haskell
- Homepage:
- Size: 64.5 KB
- Stars: 26
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://hackage.haskell.org/package/procex)
[Hackage documentation](https://hackage.haskell.org/package/procex/docs/)
[My blog post about using it as a shell](https://las.rs/blog/haskell-as-shell.html) (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
```hs
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