Interact with Ruby via command prompt window dynamically

Hi all,

I use SciTE for Ruby scripting. I wonder if it is possible to
dynamically interact with my script via command prompt from within
SciTE. For example I want to get user input and then print it to the
command prompt window.

//script
input=STDIN.gets
puts input

It works if I execute the script from a prompt window but doesn’t work
via SciTE. I wonder what is the Ruby way to interact with the user from
the command prompt window.

Thanks,

Li

Li Chen schrieb:

It works if I execute the script from a prompt window but doesn’t work
via SciTE. I wonder what is the Ruby way to interact with the user from
the command prompt window.

It does work for me.

print("Enter some text: ")
$stdout.flush
input = gets
puts(“You entered <#{input}>”)

Running in SciTE it open a cmd prompt (where the ruby interpreter is
called).

Output goes to SciTE-output pane - so you can ignore the cmd-window.
Just switch back to SciTE to enter the data and see the output.

I did use the output-pane for entering the data.

Stefan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs