Starting applications from Ruby


#1

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?


#2

On 04/03/07, I. P. removed_email_address@domain.invalid 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


#3

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!