I have a ruby script (script1.rb):
puts "Hello world!"
puts "I am a script"
I have another script (scrip2.rb):
puts "I will run a separate script"
require 'script1.rb'
puts "I have finished."
I want to be able to run script1.rb
in a new window and have script2.rb
still run while script1.rb
is running.
So: Script2 puts "I will run a separate script"
Then, it runs script1 and puts "I have finished." at the same time while script1 is puts
ing its text.
I hope this makes sense and that there's a solution.
Operating system is Windows.
Thanks, Reece
Pure Ruby is really just a scripting language without any GUI components or concepts of screens or windows.
However on Windows, and without using any GUI gem, you CAN create a new cmd.exe
command prompt with a new script using a trick like this:
puts "I will run a separate script"
system('start cmd.exe /K ruby "some ruby script.rb"')
puts "I have finished."
This will run the Ruby script some ruby script.rb
as a new process in a new command prompt window. Perhaps that gets you what you need.