Starting applications from Ruby

I

I. P.

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?
 
F

Farrel Lifson

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?

Kernel#exec sounds like what you need.

Farrel
 
I

I. P.

Farrel Lifson 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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top