WAITFOR ???

2002-07-04 Par sujet Fabien Lonardi
Que fait le waitFor() Comment faire pour recuperer la fin d'un process qu tourne et donc rendre la main. Le waitFor ()m'empeche de terminer le process. Pourquoi?

Re: WAITFOR ???

2002-07-04 Par sujet Patrice Godard
chez moi waitFor() attend bien la fin d'un process. En l'occurence un shell script sous Linux. -Original Message- From: Fabien Lonardi [EMAIL PROTECTED] To: Java [EMAIL PROTECTED] Date: Thu, 4 Jul 2002 10:07:37 +0200 Subject: WAITFOR ??? Belle journéeQue fait le waitFor() Comment

Re: WAITFOR ???

2002-07-04 Par sujet Guillaume Desnoix
Fabien Lonardi wrote: Que fait le waitFor() Comment faire pour recuperer la fin d'un process qu tourne et donc rendre la main. Le waitFor ()m'empeche de terminer le process. Pourquoi? Il faut vider les flux. Guillaume

Re: WAITFOR ???

2002-07-04 Par sujet Guillaume Desnoix
Fabien Lonardi: Et tu fais comment pour vider le flux alors qu'il est en attente?? C la question que je pose depuis un ou deux jours Deux possibilites: 1) Avant le waitFor(), tu lances deux threads separes (out et err) qui bouclent en lecture sur les flux du process. 2) Tu n'appelles pas

RE: WAITFOR ???

2002-07-04 Par sujet Fabien Lonardi
p=Runtime.getRuntime().exec(cmd.exe); ThreadEmptyBuffer t2 = new ThreadEmptyBuffer(p, cmd); t2.start(); try{ p.waitFor () ; } catch (InterruptedException intexc) { System.out.println (Interrupted Exception on waitfor: + intexc

Re: WAITFOR ???

2002-07-04 Par sujet Guillaume Desnoix
Fabien Lonardi wrote: est ce que tu vois mon erreur?? Il bloque a un moment. 1) Il faut aussi lire le flux d'erreur (getErrStream) sauf si tu es sur que ton processus n'ecrit rien sur ce flux. 2) Mais surtout in.read(byte[]) est bloquant (si je me souviens bien). Utilise plutot readLine() ou

RE: WAITFOR ???

2002-07-04 Par sujet Fabien Lonardi
(); } try{ p.waitFor () ; } catch (InterruptedException intexc) { System.out.println (Interrupted Exception on waitfor: + intexc) ; } System.out.println (Return code from process + p.exitValue ()) ; System.out.println (Done executing) ; } catch