Created
June 20, 2017 16:24
-
-
Save ch1c0t/4f5358d65046a13371bd59e41a63a642 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pty' | |
require 'expect' | |
qemu_command = "qemu-system-x86_64 -enable-kvm -cdrom ~/alpines/alpine-virt-3.6.2-x86_64.iso -nographic" | |
PTY.spawn qemu_command do |r, w, pid| | |
p pid | |
r.expect /localhost login: / do |message| | |
puts "The message is #{message}." | |
w.puts "root" | |
end | |
p r.read 10 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment