новая распаковка анализа

This commit is contained in:
2023-12-04 20:40:44 +03:00
parent 11fae0bc4e
commit 5f076f14f4
4 changed files with 100 additions and 68 deletions

View File

@@ -8,6 +8,7 @@ import GlobalData.RemoteFile.RemoteFile;
import GlobalData.User.User;
import Visual_DVM_2021.Passes.PassException;
import com.jcraft.jsch.*;
import javafx.util.Pair;
import java.io.*;
import java.nio.charset.StandardCharsets;
@@ -213,4 +214,24 @@ public class UserConnection {
public boolean Exists(RemoteFile file) throws Exception {
return Exists(file.full_name);
}
//--
public Pair<RemoteFile, RemoteFile> performScript(RemoteFile directory, String... commands) throws Exception {
RemoteFile script_file = new RemoteFile(directory, Constants.script);
RemoteFile out = new RemoteFile(directory, Constants.out_file);
RemoteFile err = new RemoteFile(directory, Constants.err_file);
//
Vector<RemoteFile> files = new Vector<>();
files.add(script_file);
files.add(out);
files.add(err);
for (RemoteFile file : files) {
if (Exists(file))
sftpChannel.rm(file.full_name);
}
//--
writeToFile("cd " + Utils.DQuotes(directory.full_name)+"\n"+ String.join("\n", commands), script_file);
//--
ShellCommand(script_file.full_name + " 1>" + Utils.DQuotes(out.full_name) + " 2>" + Utils.DQuotes(err.full_name));
return new Pair<>(out, err);
}
}