Skip to content

Commit

Permalink
Fixed the output retrieval for running processes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Jan 30, 2017
1 parent 057ef7a commit 134dff3
Showing 1 changed file with 13 additions and 19 deletions.
Expand Up @@ -238,29 +238,16 @@ public void print() {
U.print(outAndError());
}

public String out() {
Wait.until(doneReadingOut);

synchronized (this) {
return outBuffer.toString();
}
public synchronized String out() {
return outBuffer.toString();
}

public String err() {
Wait.until(doneReadingErr);

synchronized (this) {
return errBuffer.toString();
}
public synchronized String err() {
return errBuffer.toString();
}

public String outAndError() {
Wait.until(doneReadingOut);
Wait.until(doneReadingErr);

synchronized (this) {
return outAndErrBuffer.toString();
}
public synchronized String outAndError() {
return outAndErrBuffer.toString();
}

synchronized void startProcess(ProcessParams params) {
Expand Down Expand Up @@ -307,6 +294,9 @@ public ProcessHandle waitFor() {
throw new CancellationException();
}

Wait.until(doneReadingOut);
Wait.until(doneReadingErr);

return this;
}

Expand All @@ -317,6 +307,10 @@ public ProcessHandle waitFor(long timeout, TimeUnit unit) {
throw new CancellationException();
}

// FIXME timeout
Wait.until(doneReadingOut);
Wait.until(doneReadingErr);

return this;
}

Expand Down

0 comments on commit 134dff3

Please sign in to comment.