Atom runner ruby gets

Atom Runner returns nil for gets calls, causing chomp to fail with the following error:

primes.rb:16:in <main>': undefined method chomp’ for nil:NilClass (NoMethodError)
Enter a number

the offending code is this:
. . .
15 puts “Enter a number”
16 num = gets.chomp.to_i
17 puts “The smallest prime number greater than #{num} is #{next_prime(num)}”

How can I get atom runner to pause and let me enter a number and have the code complete normally?

Did you try script (

Thank you for the suggestion. I am now running the code with script, and as long as there are no “gets” statements to read data from the console, it works fine. But when there is a gets command (for example, num = gets.chomp.to_i), I get an hourglass at the bottom of the pane, and nothing else happens. How can I run an interactive script that reads data from the console?