Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > waitFor and return (very strange)

Reply
Thread Tools

waitFor and return (very strange)

 
 
depo
Guest
Posts: n/a
 
      05-17-2004
>
> Did you try my first suggestion, to leave the OutputStream open?
>
> /gordon


I thought to have tried your suggest but i forgot a close in my code.
Leaving OutputStream open solves the problem, thank you very much, but
can you explain me why?
Can i close that stream after waitFor?
I remember in previuos java version (< 1.4) it was suggest to close
OutputStream not used....but i don't remember why...

In any case THANKS YOU VERY MUCH INDEED
 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      05-17-2004
On 17 May 2004 06:24:04 -0700, depo wrote:
> I thought to have tried your suggest but i forgot a close in my
> code. Leaving OutputStream open solves the problem, thank you very
> much, but can you explain me why?


In that case, I would expect rsh -n as suggested by Dario to work too.
Read the man page.

I haven't looked particularly closely at how rsh works, but I believe
that it forks into two processes, one to handle traffic in each
direction. When you close the OutputStream, the rsh client handling
"forward" traffic gets EOF on its stdin and terminates locally, while
the other process continues to handle traffic coming back from the
remote application. Java only knows about one of these processes and
waitFor() detects when it terminates, regardless of the other one.

> Can i close that stream after waitFor?


Yes. You should close all three of the streams after waitFor().

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Telnet and 'waitfor' David Corticchiato Ruby 6 09-08-2006 08:24 AM
waitFor suspends parent + siblings? Rachel Java 0 10-15-2003 11:09 AM
Net::Telnet and waitfor context problem Jim Mozley Perl Misc 5 09-05-2003 01:40 PM
process.waitFor and readLine() blocks, help please! googlepost Java 0 07-21-2003 04:39 PM
TELNET and waitfor problems Perl Misc 1 07-16-2003 03:41 PM



Advertisments