[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

launch app and get irb prompt back

sean_n

6/16/2006 7:00:00 PM

How do i launch an external app from irb and get the irb prompt back
immediately.

For example, i want to launch my editor to edit a file in a popup
window, but want to continue using the irb session while the file is
being edited.

I tried this, but the irb session suspends until i close the gvim
editor.

irb(main):001:0> exec "gvim a.txt"

4 Answers

Tim Hoolihan

6/16/2006 8:41:00 PM

0

I'm not at a linux machine to test this and it doesn't work in windows
(unimplemented), but try:

p = proc {`gvim a.txt`}
Kernel::fork &p

seannakasone@yahoo.com wrote:
> How do i launch an external app from irb and get the irb prompt back
> immediately.
>
> For example, i want to launch my editor to edit a file in a popup
> window, but want to continue using the irb session while the file is
> being edited.
>
> I tried this, but the irb session suspends until i close the gvim
> editor.
>
> irb(main):001:0> exec "gvim a.txt"
>

Tim Morgan

6/16/2006 9:48:00 PM

0

This seems to work in Windows:

> IO.popen('notepad.exe myfile.txt')

sean_n

6/17/2006 2:22:00 AM

0


Tim Morgan wrote:
> This seems to work in Windows:
>
> > IO.popen('notepad.exe myfile.txt')

thanks!

S Wayne

6/18/2006 8:00:00 AM

0


seannakasone@yahoo.com wrote:
> How do i launch an external app from irb and get the irb prompt back
> immediately.
>
> For example, i want to launch my editor to edit a file in a popup
> window, but want to continue using the irb session while the file is
> being edited.
>
> I tried this, but the irb session suspends until i close the gvim
> editor.
>
> irb(main):001:0> exec "gvim a.txt"

Don't use exec, use system:

irb(main):001:0>system "gvim a.txt"

works for me...