Forum Discussion

MCMCMC's avatar
3 years ago

Expect class - setting .setPtyType("xterm");

Is there any way to manipulate with terminal type while using Expect class ?? I would like to change it to "xterm"

.setPtyType("xterm");

I'm facing issues to connect to terminal which is not accepting VT102.

  • @MCMCMC the Expect class is hardcoded to set VT102 on the channel. I don't think you can access that object to change it.

    Ideally we'd have this configurable somewhere, either via agent.conf, or exposing a method.

    If you're SSHing into linux you should still be able to set it through the shell with something like "export TERM=xterm" .

  • Thanks for the answer! 

    Unfrtunatelly I'm connecting to terminal which is readirecting me directly to some application, not to the prompt. 

    As I'm making first stepps in Grovvy/Java I was trying to use JSCH however i'm not sure if I would be able to print terminal output like in Expect class

    With use of JSCH, I could than use .setPtyType("xterm"); .

    I have just found some solution on this community however I dont know how to force it to re-print terminal output. I guess I would have to connect "shell" instead of "exec", right ? 

    But...I can't handle this. 

    Untill below line, it is clear to me what is happening in the script, but can't get to the screen output...:(

    session.openChannel("exec")

     

    /topic/7552-anyone-had-success-with-snmp-and-reboot-required-state/

     

    Thanks in advance for any help .