Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.
/ ex_pty Public archive

Elixir port for running programs inside a pseudo terminal

License

Notifications You must be signed in to change notification settings

SteffenDE/ex_pty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExPTY

For something that can be used in production, have a look at erlexec.

Run any system command in a pseudo terminal inside a GenServer process.

Be warned: my C code seems to work, but is very ugly

Installation

The package can be installed by adding ex_pty to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_pty, github: "SteffenDE/ex_pty"}
  ]
end

Usage

iex()> {:ok, pty} = ExPTY.start_link(handler: self())
iex()> flush()
{#PID<0.257.0>, {:data, "bash-3.2$ "}}
iex()> ExPTY.send_data(pty, "echo cool\n")
:ok
iex()> flush()
{#PID<0.257.0>, {:data, "echo cool\r\ncool\r\nbash-3.2$ "}}
iex()> ExPTY.send_data(pty, "exit\n")
:ok
iex()> flush()
{:EXIT, #PID<0.257.0>, :normal}

About

Elixir port for running programs inside a pseudo terminal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published