[283] in java-interest

home help back first fref pref prev next nref lref last post

Re: another exec/join question

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Mon Jun 12 15:36:13 1995

Date: Mon, 12 Jun 1995 12:17:36 -0700
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: dgourley@csua.berkeley.edu
Cc: java-interest@java.Eng.Sun.COM


Hi David,

> >Have you tried using System.execin()? It returns an InputStream that
> >you can read from. I suspect that the InputStream will be closed when
> >the process terminates. What really should happen is that System.exec
> >returns a Process object represention the external process. It could
> >have methods for getting its status. Maybe we can introduce this in
> >the beta release?
> 
> I am using execin currently, but I am not sure how to tell if the stream
> has been closed. I need the result stream from the command so I do look
> at it. Is there anyway to tell if a stream has been closed by the external
> process? I may be overlooking something, but I am not sure how to get
> around this problem. 

I haven't tried it but you should get an EOF when the stream is closed.
Getting an EOF means, that read() returns -1.

> I think that if possible you should incorporate a Process object into the
> beta release, if that is not possible perhaps a way to at least fetch the
> exit status of the executed process. I have run into other problems where
> it would be nice to know if the external processed exited normally or 
> abnormally. Seems that this could be part of the exec method, which 
> currently returns void. If it returned int, one could at least execute
> processes and know if they were sucessful.

Right. Maybe you could prototype an implementation for us? We are very
short on resources. Thanks.

Have fun,

	Arthur van Hoff (avh@eng.sun.com)
	http://java.sun.com/people/avh/
	Sun Microsystems Inc, M/S UPAL02-301,
	100 Hamilton Avenue, Palo Alto CA 94301, USA
	Tel: +1 415 473 7242, Fax: +1 415 473 7104
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post