Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the variable fullOutput #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Expect.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ public void send(byte[] toWrite) {
/**String representing the last match(if there was a match),
* updated after each expect() call*/
public String match;
/**String containing the full output of the last sent command,
* updated after each expect() call*/
public String fullOutput;
/**Whether the last match was successful,
* updated after each expect() call*/
public boolean isSuccess = false;
Expand Down Expand Up @@ -264,6 +267,8 @@ public int expect(int timeout, List<Pattern> list) {
ByteBuffer bytes = ByteBuffer.allocate(1024);
int n;
while (true) {
this.fullOutput = buffer.toString();

for (int i = 0; i < list.size(); i++) {
log.trace("trying to match " + list.get(i)
+ " against buffer \"" + buffer + "\"");
Expand Down Expand Up @@ -413,6 +418,8 @@ private void clearGlobalVariables() {
isSuccess = false;
match = null;
before = null;
fullOutput = null;
buffer.setLength(0);
}

/**
Expand Down