методы копирования

This commit is contained in:
2023-12-04 18:42:20 +03:00
parent 3f9ba0feb3
commit 11fae0bc4e
5 changed files with 37 additions and 16 deletions

View File

@@ -109,14 +109,10 @@ public class UserConnection {
//следует перенаправлять вывод в какой нибудь временный файл на сервере.
public String ShellCommand(String command) throws Exception {
StringBuilder result = new StringBuilder();
// System.out.println("command=" + Utils.Brackets(command));
pin.write((command + "\r\n").getBytes());
ShellParser.ReadInvitation(fromServer); //первое приглашение после эхо. возможен мусор.
result.append(ShellParser.getCommandResult(fromServer)); //возможный результат и второе приглашение.
// System.out.println("answer=" + Utils.Brackets(result));
//в реалиях визуалиазтора нас интересует только ПОСЛЕДНЯЯ СТРОКА ОТВЕТА.
String[] data = result.toString().split("\n");
// System.out.println("res="+Utils.Brackets(res));
return (data.length > 0) ? data[data.length - 1] : result.toString();
}
public void getSingleFile(String src, String dst) throws Exception {