🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17571

Monitor subprocess

#17571
From: ALTA Analytics
Date: Tue, 20 Oct 1998 00:00
20 lines
1294 bytes
Dear Colleague,
  I am trying to run a subprocess in a different thread. 
in the parent process, I want to show the user the progress information
about the subprocess. But what happend is that, All the messages come out
in a buffered fashion. it is not line by line. messages come out block by
block. Does anybody knows the solutions to it?
The following is code fragmenent in the subprocess class
it is reside in the run() method.
      String msg;
      Process proc = Runtime.getRuntime().exec(cmd);
      InputStreamReader isr =  new InputStreamReader(proc.getInputStream
()) ;
      BufferedReader bf = new BufferedReader(isr);
      InputStreamReader err = new InputStreamReader(proc.getErrorStream ())
;
      BufferedReader bferr = new BufferedReader(err);
      while ( (msg = bf.readLine()) != null) {
        fireActionPerformed(new ActionEvent(this,
ActionEvent.ACTION_PERFORMED, msg));
      }
Technical Details
Message-ID: <01bdfc63$32a6b570$1ad812c7@jpan>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,17bd555f04de7d40,start
X-Google-Attributes: gidf74b3,public
From: "ALTA Analytics" <jpan@alta-oh.com>
Subject: Monitor subprocess
Date: 1998/10/20
Message-ID: <01bdfc63$32a6b570$1ad812c7@jpan>
X-Deja-AN: 403290825
Organization: ALTA Analytics
Newsgroups: borland.public.jbuilder.java.language