crpty
crpty
Use forkpty(3)
from Crystal.
Note: this library is only an experiment/learning project for now. Only tested on Ubuntu 20.04 LTS 64-bit. Requires gcc
to compile.
Installation
-
Add the dependency to your
shard.yml
:dependencies: crpty: github: federicotdn/crpty
-
Run
shards install
Usage
require "crpty"
result = CrPty.fork_pty()
if result.pid == 0
# Child process!
# Do something like e.g. exec() to Bash
else
# Parent process!
# `result.master_fd` points to the master side of the pseudoterminal
master_fd = IO::FileDescriptor.new result.master_fd
# e.g. Copy bytes from STDIN to master_fd and from master_fd to STDOUT
end
Contributing
- Fork it (https://github.com/federicotdn/crpty/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- federicotdn - creator and maintainer
Repository
crpty
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- over 3 years ago
- August 4, 2021
License
MIT License
Links
Synced at
Fri, 22 Nov 2024 02:39:21 GMT
Languages