[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Starting applications from Ruby

I. P.

3/4/2007 11:05:00 AM

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?

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


2 Answers

Farrel Lifson

3/4/2007 11:25:00 AM

0

On 04/03/07, I. P. <stack.tcpip@rambler.ru> wrote:
> 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?
>
> --
> I. P. 2007-03-04T13:23
>
>
>

Kernel#exec sounds like what you need.

Farrel

I. P.

3/4/2007 2:33:00 PM

0

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!

--
I. P. 2007-03-04T17:01