[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: system? exec? fork? thread? Help managing external process

Michael C. Libby

1/14/2005 3:14:00 AM

On Fri, Jan 14, 2005 at 08:20:25AM +0900, McMahon, Chris wrote:
>
> Hello...
> I'm new to Ruby and I need some help with managing an external
> process. I'm on Windows, and I want to do something (overly simplified)
> like this:
>
> File.new(file_to_be_handled_by_outside_process.txt)
> system ("C:\\filewatcher.exe file_to_be_handled_by_outside_process.txt")
> <write stuff to file_to_be_handled_by_outside_process.txt>
>
> The foreign process started by system() never stops. I need to
> return control to the Ruby script after the system() call so that I can
> have the Ruby script generate information for the foreign process to
> handle.
> Any suggestions would be welcome...
> -Chris
>

IO.popen perhaps? That would allow you to read or write directly to
the external process.

But in your case fork seems the more likely choice, especially if your
external process may not finish before your Ruby script. Then you
probably want to use fork with Process.detach I would think.

-Michael


3 Answers

The PHANTOM

7/14/2010 5:08:00 PM

0

On Jul 14, 12:03 pm, "lab~rat >:-)" <ch...@cheeze.net> wrote:
> On Wed, 14 Jul 2010 08:48:47 -0700, Brian Wraith
> <brianwra...@newzealand.invalid> puked:
>
>
>
>
>
> >On 7/14/2010 8:42 AM, lab~rat >:-) wrote:
> >> On Wed, 14 Jul 2010 08:24:14 -0700, Brian Wraith
> >> <brianwra...@newzealand.invalid>  puked:
>
> >>>>> June of 1920 here.
>
> >>>> What?
>
> >>> What is your question?
>
> >> You're 90?
> >> --
> >> lab~rat>:-)
> >> Do you want polite or do you want sincere?
>
> >Yup, crossed the bridge a couple of weeks ago.
>
> Never would have guessed that.  Congrats.
> --
> lab~rat  >:-)
> Do you want polite or do you want sincere?- Hide quoted text -
>
> - Show quoted text -

Dementia !!

Brian Wraith

7/14/2010 5:12:00 PM

0

On 7/14/2010 10:03 AM, lab~rat >:-) wrote:
> On Wed, 14 Jul 2010 08:48:47 -0700, Brian Wraith
> <brianwraith@newzealand.invalid> puked:
>
>> On 7/14/2010 8:42 AM, lab~rat>:-) wrote:
>>> On Wed, 14 Jul 2010 08:24:14 -0700, Brian Wraith
>>> <brianwraith@newzealand.invalid> puked:
>>>
>>>>>>
>>>>>> June of 1920 here.
>>>>>
>>>>> What?
>>>>
>>>> What is your question?
>>>
>>> You're 90?
>>> --
>>> lab~rat>:-)
>>> Do you want polite or do you want sincere?
>>
>> Yup, crossed the bridge a couple of weeks ago.
>
> Never would have guessed that. Congrats.

Thanks, is that because I look so youthful and virile? :-)

Rhetorical question, PLEASE, do not answer. :-)

Brian Wraith

7/14/2010 5:21:00 PM

0

On 7/14/2010 10:08 AM, The PHANTOM wrote:
> On Jul 14, 12:03 pm, "lab~rat>:-)"<ch...@cheeze.net> wrote:
>> On Wed, 14 Jul 2010 08:48:47 -0700, Brian Wraith
>> <brianwra...@newzealand.invalid> puked:
>>
>>
>>
>>
>>
>>> On 7/14/2010 8:42 AM, lab~rat>:-) wrote:
>>>> On Wed, 14 Jul 2010 08:24:14 -0700, Brian Wraith
>>>> <brianwra...@newzealand.invalid> puked:
>>
>>>>>>> June of 1920 here.
>>
>>>>>> What?
>>
>>>>> What is your question?
>>
>>>> You're 90?
>>>> --
>>>> lab~rat>:-)
>>>> Do you want polite or do you want sincere?
>>
>>> Yup, crossed the bridge a couple of weeks ago.
>>
>> Never would have guessed that. Congrats.
>> --
>> lab~rat>:-)
>> Do you want polite or do you want sincere?- Hide quoted text -
>>
>> - Show quoted text -
>
> Dementia !!

Pot - Kettle alert!!!!