java - ExpectIt : Supress console echo -


refer: expectit : trouble implementing sudo -i

hi all, how can avoid echoing output of expectit java console?

this how started ssh:

public void connect( string host, string user, string password ) throws exception {     this.host = host;     this.user = user;     this.password = password;     ssh = new sshclient();     ssh.addhostkeyverifier( new promiscuousverifier() );     ssh.connect(host, port);     ssh.authpassword(user, password);     session = ssh.startsession();      session.allocatedefaultpty();     shell = session.startshell();      expect = new expectbuilder()             .withoutput(shell.getoutputstream())             .withinputs(shell.getinputstream(), shell.geterrorstream())             .withinputfilters(removecolors(), removenonprintable())             .withexceptiononfailure()             .withtimeout(30, timeunit.seconds)             .build();      string result = expect.expect( matchers.contains( prompt ) ).getinput();     consoleout.add( result );  } 

now results taken expect echo console. can take "result" string, goes tomcat console ( i'm sure i'm not send to).

expect.sendline( command ); string result = expect.expect( matchers.contains( prompt ) ).getinput(); 

i'm running in tomcat container (web environment).

enter image description here

you can disable command echo sending stty -echo command @ beginning of session. take @ this example.

i suggest post questions expectit user group rather on stackoverflow since there few people using library.


Comments