Question: I am receiving "strange" character output. I am thinking that one How to obtain regular outputs seen in potty session "funny" I mean I should see this: And I'm looking into this: This is similar to the answer, the problem does not satisfy my need. Answer: To call the channel set, set sendNextCommand method is to see that Basically, when I look at something like this: Now I will usually just get rid of this kind of thing, but I want to get it properly, and it also seems that there is a number of variants for the variants, so I am here I hope you can help :) Note: I will call it my Windows machine I am running through my IDE (an eclipse rip) through the medium, but I have tried debugging and variable Yes, these are ANSI escape sequences, in the case of For any particular reason, you can fire
testfile.txt
[01; 32mtestfile.txt [00m
is setPty (false) , Which completely removes the "pseudo-terminal", but in real time I should have the output of the channel shell. Here's an example of what I'm doing:
ChannelShell channel = (channel shell) session.openChannel ("shell"); Channel.setOutputStream (new printstream (New BytereOnputStream), true, "UTF-8") {@ Override Public Wide List (Byte [B], int, off lane] {super.written (b, off, lane) ; String output = new string (b, off, lane); system out. Print (output); sendNextCommand (output); // next command depends on the output executed, this is why I do not need it .}}); PipedInputStream = new pipe inputtream (); ChannelInput = New PipedOutputStream (in); (In) channel.setInputStream; Channel.connect (); While (! Channel.isClosed () & Channel WaitRetries ++
[user @ server ~] $
ls should return it:
testfile.txt but instead return it Yes:
[01; 32mtestfile.txt [00m (Note: I can not copy and paste the first character, but this is a box, four of 27 code which I think is an escape character ).
outputs. In fact, "funny" character shows I just want to make sure that this is only the IDE I have also tried to show it in
JOptionPane.messageDialog to ensure that it is still not a letter. Thanks!
ls
ls has a
- color = never option, which should resolve specific
ls < P> Calling
ChannelShell.setPtyType ("dumb") can also help (untested). You may have to look around to find a terminal type that disables the escape sequence.
ls instead of using Java methods to check directory contents?
Wednesday, 15 April 2015
java - Funny Shell Output: [01;32mtestfile.txt[00m instead of testfile.txt -
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment