Forum: Ruby Starting applications from Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
I. P. (Guest)
on 2007-03-04 13:05
(Received via mailing list)
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?
Farrel L. (Guest)
on 2007-03-04 13:25
(Received via mailing list)
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
I. P. (Guest)
on 2007-03-04 16:33
(Received via mailing list)
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 topic is locked and can not be replied to.