U
uljanow
hi,
is there a way to read directly from stdout of a process? I guess my
problem is that I'm using InputStreams, but I haven't found another
way.
ProcessBuilder builder = new ProcessBuilder("tail", "-f", "foo.log");
Process child = builder.start();
Scanner s = new Scanner(child.getInputStream()).useDelimiter("\\n");
while (!interrupted && s.hasNext())
log.append(s.nextLine() + "\n");
The problem with the code example is that the output of tail appears
after a buffer is filled. The log variable (JTextArea) appends the
string immediately.
Regards
is there a way to read directly from stdout of a process? I guess my
problem is that I'm using InputStreams, but I haven't found another
way.
ProcessBuilder builder = new ProcessBuilder("tail", "-f", "foo.log");
Process child = builder.start();
Scanner s = new Scanner(child.getInputStream()).useDelimiter("\\n");
while (!interrupted && s.hasNext())
log.append(s.nextLine() + "\n");
The problem with the code example is that the output of tail appears
after a buffer is filled. The log variable (JTextArea) appends the
string immediately.
Regards