• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Runtime.getRuntime().exec()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Runtime.getRuntime().exec()


  • Subject: Re: Runtime.getRuntime().exec()
  • From: David Teran <email@hidden>
  • Date: Thu, 18 Aug 2005 10:12:46 +0200

Why not logging the result. Then you will know more:

Process p = Runtime.getRuntime ().exec ( command );
if ( NSLog.debugLoggingAllowedForLevel ( NSLog.DebugLevelDetailed  ) )
{
    NSLog.out.appendln ( "process waiting " );
}
int terminated = p.waitFor ();
if ( NSLog.debugLoggingAllowedForLevel ( NSLog.DebugLevelDetailed  ) )
{
    NSLog.out.appendln ( "result: terminated (0=OK) : " + terminated );
    BufferedReader in = new BufferedReader( new InputStreamReader ( p.getErrorStream () ) );
    NSLog.out.appendln ( "error : " + in.readLine () );
}


This will not work if the process which is being executed has more output or error message than the InputStream or ErrorStreams' buffer from the process. Then p.waitFor() will never return because the process tries to write more output to the input stream but the input stream will be cleared / flushed / read from -after- the waitFor() method returned. Please read my previous post to this thread.

cheers, David


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Runtime.getRuntime().exec() (From: Wolfram Stebel <email@hidden>)

  • Prev by Date: Unicode trouble
  • Next by Date: Re: using webobjects tags with javascript generated HTML
  • Previous by thread: Re: Runtime.getRuntime().exec()
  • Next by thread: Re: Runtime.getRuntime().exec()
  • Index(es):
    • Date
    • Thread