Skip to content

Run any interactive command in a PTY, while being able to record any input or output (including stderr)

License

Notifications You must be signed in to change notification settings

engineyard/pty-recorder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PTY::Recorder

Run any interactive command in a PTY, while being able to record any input or output (including stderr).

PTY::Recorder acts like a middleman for fully interactive unix command sessions. Much like the script command or other terminal recording libraries, you can record everything that is input or output.

The advantage of this gem is that it can be invoked programatically. The end user will be presented with the interface to the command session with no apparent changes, but the parent process can oversee the interaction.

Input and Output streams are handled in much the same way as a normal ruby command runner. Any interactive sessions like pry, irb, ssh, bash, vim, and more can be invoked through PTY::Recorder to record everything that is input or output.

Usage

Basic command running:

inlog = ""
PTYRecorder.spawn('irb --simple-prompt', inlog: inlog) # blocks until user exits irb
puts "You typed:"
puts inlog.inspect

About

Run any interactive command in a PTY, while being able to record any input or output (including stderr)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages