From: Jan Svitok Date: 2006-08-11T17:07:27+09:00 Subject: Re: Start an external application - How? On 8/11/06, ilsemanetor@gmail.com wrote: > > Joe Percival wrote: > > I don't need details, just a push in the right direction. > > > > How do you start a series of external applications from within ruby (on > > windows). For example, I want to start mywebcamapp.exe and > > myweatherapp.exe. > > > > Also, is it possible to have a ruby script that will stop an external > > process? > > > > Thanks, > > joe > > > > -- > > Posted via http://www.ruby-forum.com/. > > Anyone more knowledgable, please correct the below: > Basically, you will either want to use Threads or multiple processes.I > don't have much experience with threads, and little more with > processes. From the pickaxe (Programming Ruby), it seems that threads > may wait for the operating system call to finish before allowing both > itself and all other threads to continue. A thread is also internal to > the currently running ruby or irb session, and as such are much more > useful executing ruby code. That being said, Threads provide alot of > neat features and such. > > What you probably want is a new process. > > fork do > `my_program.exe` > end > > and then if you ever want you program to wait for the termination of > all your applications running, use: > > Process.waitall > > Note that forking and new processes and such are many times operating > system dependent. I have no clue as to if Windows supports this (I On Windows, fork in not implemented. :( For this purpose I mainly use `start "" progname.exe` (note the double quotes: if the first parameter has quotes, it's the title of the window. That means `start "c:\Program Files\Anything.exe" won't start the program...) start will start program and return, so ruby can continue... Jano