Chris Abbey wrote:
...
> *note: Process.waitFor() has some ugly problems (on all platforms)
> with never returning your call....

...It seemed to be a problem also when I played with this (using
JPython, not java directly, though). But then I discovered this was my
lack: I must empty both Output and Error streams before process can
finish. Moreover such as callee can intermix outputs to stdout and
stderr, I had to empty them in different threads. Then waitFor()
returned as awaited. This behaviour can be masked by the fact that
stdout is usually buffered. The following simple program was useful for
me to  check whether my Java code uses exec - waitFor stuff properly:

#include <stdio.h>
int main(void)                                      {
int n = 100, i = 0;
while(n--)                                       {
fprintf(stdout, "STDOUT line number %d\n", ++i)
fprintf(stderr, "STDERR line number %d\n", i)    }  }

Hopefully this information can be useful to somebody.

Pavel


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to