yanne / api-test

0 stars 0 forks source link

Add possibility to configure shell/terminal size in `Open Connection` #46

Closed yanne closed 10 years ago

yanne commented 10 years ago
  1. use Login keyword, login to SSH server
  2. use Write keyword to run command which will generate some long output, so that the output length exceed the $LINES of terminal, then:
  3. ${output} = Read Until Prompt

I found the ${output} is different from what I get by typing command manually in terminal, the ${output} is mess.

e.g. when you execute the command manually in xterm SSH, you get:

Name Sex Age Title Department

lonestep Male 90 Noob NewBieLab

but the same command in robotframework-sshlibrary you get:

Name Sex Age Tit Departm

le ent

Shawn Male 90 No NewBie ob Lab

VERSION:robotframework-sshlibrary 1.0 OS: Ubuntu 12.04 LTS

I don't know what is the underlaying dependencies of the ssh, does the output depend on terminal size of client? or ssh server's terminal setting? I found no document and no solution on web, and the output is just mess.

This issue was originally opened at Google Code on Jun 7, 2012.

yanne commented 10 years ago

Original comment by lones...@gmail.com on Jun 10, 2012.

 After I look into the source of SSH Paramiko library, I think I've found the way to fix terminl size problem:

 Take my desktop Ubuntu for example:
 #open client.py under /usr/local/lib/python2.7/dist-packages/paramiko
 /usr/local/lib/python2.7/dist-packages/paramiko$ sudo kate client.py

 Modify the following line:
 def invoke_shell(self, term='vt100', width=84, height=24):
 to fit your need:
 def invoke_shell(self, term='vt100', width=120, height=120):

 NOT THE PROBLEM OF SSH LIBRARY YET IT'S NOT THE PROBLEM OF Paramiko, though, My suggestion is to supply an keyword or argument, leave the user a way to 

customize their terminal size for invoke_shell(). Else they will get mess up output if the size too small, and they just don't know what happened.

-- Shawn (lonestep@gmail.com)

yanne commented 10 years ago

Original comment by janne.t....@gmail.com on Aug 13, 2012.

A new keyword Open Shell will be added.

That keyword can be used to configure the shell parameters before using Write and Read keywords.

yanne commented 10 years ago

Original comment by janne.t....@gmail.com on Aug 13, 2012.

Added in r130

yanne commented 10 years ago

Original comment by janne.t....@gmail.com on Aug 15, 2012.

Instead of adding new keyword, we decided to enhance Open Connection so that it opens the shell automatically, and add the shell configuration arguments to Open connection.