You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by dstieg1 <ds...@gmail.com> on 2011/05/27 19:49:09 UTC

Re: Programmatically connecting to the console does not work with long command

Taking a closer look at the bigger example on
http://svn.apache.org/repos/asf/karaf/trunk/client/src/main/java/org/apache/karaf/client/Main.java

I tried ((ChannelShell) channel).setupSensibleDefaultPty();
but that didn't work as it gave the default dimensions.

I finally ending up using the following: (where String command is the
command to be executed):

final int commandLengthInBytes = command.getBytes();
((ChannelShell) channel).setPtyColumns(commandLengthInBytes +
(commandLengthInBytes/5));

I could not use the exact command size in bytes or +1 as that still failed.
I settled on adding a fifth more to the command byte length which seemed to
work nicely. It would be nice if anybody can give an insight as to why there
must be the extra columns for the command to be executed correctly.

--
View this message in context: http://karaf.922171.n3.nabble.com/Programmatically-connecting-to-the-console-does-not-work-with-long-command-tp2992927p2993851.html
Sent from the Karaf - User mailing list archive at Nabble.com.