[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Run the program and return immediately

Victor 'Zverok' Shepelev

2/22/2008 4:59:00 PM

Hi all.

The question first seemed simple for me, but after hour of manual-reading
and googling I still have no answer.

The question: on Windows, how do I run some program and return immediately?
I mean, something like

system('blah.exe') #blah is long packet program, I want system to return
immediately after blah.exe loaded, not after it was ended.

Thanks.

Zve


2 Answers

Siep Korteling

2/22/2008 5:21:00 PM

0

Victor 'Zverok' Shepelev wrote:
> Hi all.
>
> The question first seemed simple for me, but after hour of
> manual-reading
> and googling I still have no answer.
>
> The question: on Windows, how do I run some program and return
> immediately?
> I mean, something like
>
> system('blah.exe') #blah is long packet program, I want system to return
> immediately after blah.exe loaded, not after it was ended.
>
> Thanks.
>
> Zve

`start blah.exe`

Note the ` , it's not a '.

Regards,

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

Justin Collins

2/22/2008 5:23:00 PM

0

Victor 'Zverok' Shepelev wrote:
> Hi all.
>
> The question first seemed simple for me, but after hour of manual-reading
> and googling I still have no answer.
>
> The question: on Windows, how do I run some program and return immediately?
> I mean, something like
>
> system('blah.exe') #blah is long packet program, I want system to return
> immediately after blah.exe loaded, not after it was ended.
>
> Thanks.
>
> Zve
>

One way:

t = Thread.new do
system("blah.exe")
end

#do other stuff

t.join

Traditional fork and exec way:

child_pid = fork
exec("blah.exe") unless child_pid

#do stuff

Process.wait # or Process.detach


I believe this should work fine on Windows.

-Justin