From 0a64817fb80016030c03518fb9459f63c11605ea Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 13 Aug 1999 05:37:52 +0000 Subject: remove marshal/gtk/kconv git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/pty/script.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ext/pty/script.rb (limited to 'ext/pty/script.rb') diff --git a/ext/pty/script.rb b/ext/pty/script.rb new file mode 100644 index 0000000000..6aaafec061 --- /dev/null +++ b/ext/pty/script.rb @@ -0,0 +1,38 @@ +require 'pty' + +if ARGV.size == 0 then + ofile = "typescript" +else + ofile = ARGV[0] +end + +logfile = File.open(ofile,"a") + +system "stty -echo raw lnext ^_" + +PTY.spawn("/bin/csh") do + |r_pty,w_pty,pid| + + Thread.new do + while true + w_pty.print STDIN.getc.chr + w_pty.flush + end + end + + begin + while true + c = r_pty.getc + next if c.nil? + print c.chr + STDOUT.flush + logfile.print c.chr + end + rescue + # print $@,':',$!,"\n" + logfile.close + end +end + +system "stty echo -raw lnext ^v" + -- cgit v1.2.3