Process output overwritten

Joined
May 23, 2011
Messages
1
Reaction score
0
Hi all,

I'm trying to execute a command using Process and to read and process the output. Here is the code:

Process p = Runtime.getRuntime().exec(cmd);
input = new BufferedReader (new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
...process line...
}

The problem is that some lines are getting partially overwritten by other lines, i.e. the output should be:

TMEmulation log_pseduo_allocation (34985) (2 45 76 89 90)
__divw clock timer (8273) (4 6 67 4 2)

and instead during the processing there are some lines that are read like this:

TMEmulation log_pseduo_allocation (34985) (2__divw 45clock 76timer (89 8273) 904) (6 67 4 2)

It's like the two lines got merged together.

I'm not expert in Java and I haven't found anything about it on the internet. Anybody knows what I'm doing wrong?

Thanks in advance,
Patricia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top