Page 1 of 1

ScSSHShell: How to get clean result?

Posted: Tue 29 Jan 2008 14:49
by dcrudo
hello,

I have some troubles having the TScSSHShell behaving correctly...

with this code:

scshell.WriteString('ls -l'+ #13#10);
memo1.Lines.Add(scshell.ReadString);

the first time nothing happens, i only get the prompt:

[admin@myserver admin]$

the second time i issue the command i get:

[00mtotal 224
-rwxrwxr-- 1 admin admin 71 Jul 11 2005 [01;32mags.log[00m
-rw-r--r-- 1 admin admin 179 Aug 4 2005 [00mcall_wsdl.vbs[00m
-rw-rw-r-- 1 admin admin 1912 Apr 16 2007 [00mcrontab.admin.backup[00m
drwxr-xr-x 2 admin admin 4096 Apr 10 2006 [01;34mcygwin[00m
-rw-r--r-- 1 admin admin 268 Jul 14 2005 [00mdir_structure.txt[00m
-rwxrwxr-- 1 admin admin 53 Jul 11 2005 [01;32medi.log[00m
-rw-r--r-- 1 admin admin 195007 Aug 10 2006 [00mlog.ivo[00m
-rw------- 1 admin admin 3840 Aug 10 2006 [00mmbox[00m
[m[admin@myserver admin]$
[A[admin@myserver admin]$[K
[admin@myserver admin]$

- how to i get a clean result? for instance the last 3 lines...
- what is the '[K' and '[00' string appearing everywhere?

Thank you a lot!

Dave

Re: ScSSHShell: How to get clean result?

Posted: Wed 30 Jan 2008 15:18
by Dimon
dcrudo wrote:- how to i get a clean result? for instance the last 3 lines...
You can not clear the result. TScSSHShell receives all data which SSH server returns. You need to call the ReadString method until it returns an empty string.
Alternatively you can use NonBlocking mode. You can find more detailed information about it in the SecireBridge help.
dcrudo wrote:- what is the '[K' and '[00' string appearing everywhere?
SSH servers return data in terminal-specific form of "vt100" type. Your application should use the terminal type to determine which character set is used. The character set can be also determined using some external means. At the present time SecureBridge does not support working with terminals.