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

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

@@ -164,9 +164,14 @@ public class TestsSupervisor_2022 {
}
public void DownloadResults() throws Exception {
Utils.CheckDirectory(packageLocalWorkspace);
RemoteFile remote_results = new RemoteFile(packageRemoteWorkspace, "results");
RemoteFile remote_results_archive = new RemoteFile(packageRemoteWorkspace, "results.zip");
connection.ShellCommand(
"zip -r "+Utils.DQuotes(remote_results_archive.full_name)+" "+Utils.DQuotes(remote_results.full_name));
/*
RemoteFile remote_results_archive = new RemoteFile(packageRemoteWorkspace.full_name, "results.zip");
File results_archive = new File(packageLocalWorkspace, "results.zip");
if (connection.Exists()) {
connection.getSingleFile(remote_results_archive, results_archive);
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();

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 {