no message

This commit is contained in:
2024-04-26 22:21:56 +03:00
parent cf81637812
commit c84a648bb6
6 changed files with 18 additions and 10 deletions

View File

@@ -466,6 +466,12 @@ public class UserConnection {
shellChannel = null;
System.gc();
}
public void waitForFileCreation(RemoteFile file) throws Exception {
while (!Exists(file)){
System.out.println(file.name +" NOT FOUND");
Utils.sleep(1000);
}
}
//возможно в дальнейшем обобщить чтобы вместо PID был файл вывода с задаваемым именем?
public String startShellProcess(RemoteFile directory, String outFileName, String... commands) throws Exception {
Vector<String> commands_ = new Vector<>();
@@ -486,10 +492,7 @@ public class UserConnection {
RemoteFile outFile = new RemoteFile(directory, outFileName);
ShellConnect();
pin.write(("nohup " + start_command + " &\r\n").getBytes());
while (!Exists(outFile)){
System.out.println(outFileName +" NOT FOUND");
Utils.sleep(1000);
}
waitForFileCreation(outFile);
ShellDisconnect();
return readFromFile(outFile).replace("\n","").replace("\r","");
}