A
Ara.T.Howard
i've been up for a really long time, so perhaps i'm missing something silly,
but this script 'seems' to work (all three dots are printed), but no id_rsa
file is made? do i have to signal the child to die or something? any other
useful debugging tips? it would be great if PTY could 'tee' it's output to
stdout for debugging
~/eg/ruby > cat ssh-keygen.rb
require 'pty'
require 'expect'
path = ARGV.shift || 'id_rsa'
File.unlink path rescue nil
PTY.spawn('ssh-keygen -t rsa') do |r,w,cid|
r.expect %r/^Enter.*:\s+/ do
print '.'
w.puts path
end
r.expect %r/^Enter.*:\s+/ do
print '.'
w.puts ''
end
r.expect %r/^Enter.*:\s+/ do
print '.'
w.puts ''
end
w.flush
w.close
puts
end
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================
but this script 'seems' to work (all three dots are printed), but no id_rsa
file is made? do i have to signal the child to die or something? any other
useful debugging tips? it would be great if PTY could 'tee' it's output to
stdout for debugging
~/eg/ruby > cat ssh-keygen.rb
require 'pty'
require 'expect'
path = ARGV.shift || 'id_rsa'
File.unlink path rescue nil
PTY.spawn('ssh-keygen -t rsa') do |r,w,cid|
r.expect %r/^Enter.*:\s+/ do
print '.'
w.puts path
end
r.expect %r/^Enter.*:\s+/ do
print '.'
w.puts ''
end
r.expect %r/^Enter.*:\s+/ do
print '.'
w.puts ''
end
w.flush
w.close
puts
end
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================