fix недоделки с одиночным запуском. стояла ожидающая команда. v++
This commit is contained in:
@@ -115,7 +115,6 @@ public class UserConnection {
|
||||
//--
|
||||
//todo из за мусора результатом пользоваться в общем случае невозможно.
|
||||
//следует перенаправлять вывод в какой нибудь временный файл на сервере.
|
||||
|
||||
/*
|
||||
public String ShellCommand(String command) throws Exception {
|
||||
StringBuilder result = new StringBuilder();
|
||||
@@ -406,7 +405,7 @@ public class UserConnection {
|
||||
}
|
||||
execChannel.disconnect();
|
||||
}
|
||||
public void CommandNoRead(String... commands) throws Exception {
|
||||
public void CommandNoWait(String... commands) throws Exception {
|
||||
if (commands.length > 0) {
|
||||
String command = String.join("\n", commands);
|
||||
execChannel = (ChannelExec) session.openChannel("exec");
|
||||
@@ -416,32 +415,12 @@ public class UserConnection {
|
||||
execChannel.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public String CommandWithAnswer(char end, String... commands) throws Exception {
|
||||
String output = "";
|
||||
if (commands.length > 0) {
|
||||
String command = String.join("\n", commands);
|
||||
// UI.Print(DebugPrintLevel.Session, command);
|
||||
// UI.Print(DebugPrintLevel.Session, "Creating Exec Channel.");
|
||||
// System.out.println(Utils.Brackets(command));
|
||||
execChannel = (ChannelExec) session.openChannel("exec");
|
||||
execChannel.setErrStream(System.err);
|
||||
InputStreamReader reader = new InputStreamReader(execChannel.getInputStream());
|
||||
execChannel.setCommand(command);
|
||||
execChannel.connect();
|
||||
char[] chars = new char[1];
|
||||
while (reader.read(chars) >= 0) if (chars[0] == end) break;
|
||||
else output += chars[0];
|
||||
execChannel.disconnect();
|
||||
}
|
||||
// System.out.println(Utils.Brackets(output));
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
public void copy(RemoteFile src, RemoteFile dst) throws Exception {
|
||||
ShellCommand("cp " + Utils.DQuotes(src.full_name) + " " + Utils.DQuotes(dst.full_name));
|
||||
}
|
||||
*/
|
||||
public void performScriptNoWait(RemoteFile directory, String... commands) throws Exception {
|
||||
RemoteFile script_file = new RemoteFile(directory, Constants.script);
|
||||
if (Exists(script_file))
|
||||
sftpChannel.rm(script_file.full_name);
|
||||
//--
|
||||
writeToFile("cd " + Utils.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
|
||||
CommandNoWait(Utils.DQuotes(script_file.full_name));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user