Run the program and return immediately

Run the program and return immediately

Post by Victor 'Zv » Sun, 24 Feb 2008 01:58:34


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
 
 
 

Run the program and return immediately

Post by Siep Korte » Sun, 24 Feb 2008 02:20:32


`start blah.exe`

Note the ` , it's not a '.

Regards,

Siep
--
Posted via http://www.yqcomputer.com/

 
 
 

Run the program and return immediately

Post by Justin Col » Sun, 24 Feb 2008 02:22:35


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