[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Exiting a ruby script

Jason Burgett

3/11/2007 6:24:00 PM

I'm in the process of playing around with a, application launcher
script. It's fairly far along, but I can't seem to get the script to
exit when the application is actually launched. Here's the final bit of
code:

@finalApps.each {|finalApp| if finalApp.id == runApp.to_i
updateRanking finalApp.name
symbolMatch = finalApp.command.match(/
%/)
if symbolMatch
system(symbolMatch.pre_match)
else
system(finalApp.command)
end
end
}

There's some extra stripping of the command in there. The functional
part is the internal if loop. After "system(symbolMatch.pre_match)" or
"system(finalApp.command)" the app launches properly, but in the console
the ruby script stays open until the app is closed.

Is there a way to get the ruby script to terminate immediately after the
app is successfully launched?

--
Posted via http://www.ruby-....

2 Answers

Stefano Crocco

3/11/2007 7:28:00 PM

0

Alle domenica 11 marzo 2007, Jason Burgett ha scritto:
> I'm in the process of playing around with a, application launcher
> script. It's fairly far along, but I can't seem to get the script to
> exit when the application is actually launched. Here's the final bit of
> code:
>
> @finalApps.each {|finalApp| if finalApp.id == runApp.to_i
> updateRanking finalApp.name
> symbolMatch = finalApp.command.match(/
> %/)
> if symbolMatch
> system(symbolMatch.pre_match)
> else
> system(finalApp.command)
> end
> end
> }
>
> There's some extra stripping of the command in there. The functional
> part is the internal if loop. After "system(symbolMatch.pre_match)" or
> "system(finalApp.command)" the app launches properly, but in the console
> the ruby script stays open until the app is closed.
>
> Is there a way to get the ruby script to terminate immediately after the
> app is successfully launched?

If I understand your problem correctly, you should use exec instead of system,
which replace the ruby interpreter with the command given as argumnt.

I hope this helps

Stefano

Jason Burgett

3/13/2007 4:02:00 PM

0

Actually, the process still holds open while the "launched" app running.
As soon as that last enter key is pressed to launch the app I need the
ruby script to release the console.


> If I understand your problem correctly, you should use exec instead of
> system


--
Posted via http://www.ruby-....