With the following code I'd like to read the InputStream from spawn.send("ls | grep *.dat\n");
. My calss implements Spawnable
and it's method getStdout()
, but have no clue how to use it.
ExpectJ docs says: getStdout()
- Get a stream from which the Spawn's stdout can be read. But this doesn't get me any futher.
private void expectC() throws IOException, TimeoutException, ExpectJException, InterruptedException {
ExpectJ expectJ = new ExpectJ();
Spawn spawn = expectJ.spawn("192.168.1.60", 22, "login", "pass");
spawn.send("ls | grep *.dat\n");
spawn.expectClose();
}