1999-08-13 01:37:52 -04:00
|
|
|
require 'pty'
|
|
|
|
|
|
|
|
if ARGV.size == 0 then
|
|
|
|
ofile = "typescript"
|
|
|
|
else
|
|
|
|
ofile = ARGV[0]
|
|
|
|
end
|
|
|
|
|
|
|
|
logfile = File.open(ofile,"a")
|
|
|
|
|
|
|
|
system "stty -echo raw lnext ^_"
|
|
|
|
|
2003-03-07 00:59:42 -05:00
|
|
|
PTY.spawn("/bin/csh") do |r_pty,w_pty,pid|
|
1999-08-13 01:37:52 -04:00
|
|
|
|
|
|
|
Thread.new do
|
|
|
|
while true
|
|
|
|
w_pty.print STDIN.getc.chr
|
|
|
|
w_pty.flush
|
|
|
|
end
|
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
|
1999-08-13 01:37:52 -04:00
|
|
|
begin
|
|
|
|
while true
|
1999-08-24 04:21:56 -04:00
|
|
|
c = r_pty.sysread(512)
|
|
|
|
break if c.nil?
|
|
|
|
print c
|
1999-08-13 01:37:52 -04:00
|
|
|
STDOUT.flush
|
1999-08-24 04:21:56 -04:00
|
|
|
logfile.print c
|
1999-08-13 01:37:52 -04:00
|
|
|
end
|
|
|
|
rescue
|
|
|
|
# print $@,':',$!,"\n"
|
|
|
|
logfile.close
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
system "stty echo -raw lnext ^v"
|
|
|
|
|