Skip to content
Run executable wrapped in pseudoterminal with UNIX domain socket for communicating with it
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
src/System/Posix
.gitignore
LICENSE
README.md
Setup.hs
default.nix
pty-wrapper.cabal
pty-wrapper.nix
shell.nix

README.md

pty-wrapper

Run executable wrapped in pseudoterminal with UNIX domain socket for receiving data and controlling it.

Uses simple JSON protocol, keys field refers to keys to send to the executable (base64 encoded), rows and cols (if set) control the size of the pseudoterminal. Sample protocol messages:

{"keys": "cHE=", "rows": null, "cols" :null}
{"keys": null,   "rows": 10,   "cols": 20}

Client side recieves raw data as output from the executable.

Usage

nix build

# run server
./result/bin/pty-wrapper processTitle /tmp/testsock.ipc htop

# in another terminal, run sample client
sudo ./result/bin/pty-wrapper-client /tmp/testsock.ipc

By defualt access to UNIX socket is restricted to root (UID 0) hence the use of sudo for client.

Client can send events to server, it reads lines from standard input and sends these to wrapped application. If line starts with character !, it sends a request to change pseudoterminal size to 10, 20.

You can’t perform that action at this time.