Starting applications from Ruby

ruby-talk ML DE I. P.

At the end of Ruby program I want to show results to user. But sending
them to standard output isn’t appropriate because of encoding issues
(cp866 vs cp1251). So I put data to file and finish program with

%x{notepad result.txt}

(my program is executed in Windows only)

Problem: Ruby interpreter’s process waits until user closes Notepad.

Is there any way to separate that processes: interpreter executes
program, open Notepad, do not wait until it’s window is closed and
shutdown?

On 04/03/07, I. P. [email protected] wrote:

Problem: Ruby interpreter’s process waits until user closes Notepad.

Is there any way to separate that processes: interpreter executes
program, open Notepad, do not wait until it’s window is closed and
shutdown?


I. P. 2007-03-04T13:23

Kernel#exec sounds like what you need.

Farrel

Farrel L. DE I. P.

FL> Kernel#exec sounds like what you need.
This way produced the same result:
exec “notepad result.txt”

  • ruby.exe and notepad.exe were both present.

And this way worked just as I want:
exec “start notepad result.txt”

  • ruby.exe closed and notepad.exe is active

Thank you!

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