Compare commits
No commits in common. "897dcac2433d6f9c1caaa64403a6afebc82e27da" and "c8aa18338abbaa838e128faba3ca613d2e152396" have entirely different histories.
897dcac243
...
c8aa18338a
@ -17,7 +17,6 @@ import java.nio.file.Paths;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.logging.FileHandler;
|
import java.util.logging.FileHandler;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -30,7 +29,6 @@ import javafx.scene.image.Image;
|
|||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.util.Pair;
|
|
||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
@ -176,14 +174,6 @@ public class Main extends Application {
|
|||||||
public StationRunException(String message) {
|
public StationRunException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StationRunException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StationRunException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runStation(MainParsedArguments parsedArgs) throws StationRunException {
|
public static void runStation(MainParsedArguments parsedArgs) throws StationRunException {
|
||||||
@ -233,21 +223,6 @@ public class Main extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (loadedStation.getMessageMethod()) {
|
switch (loadedStation.getMessageMethod()) {
|
||||||
case StationSettings.MessageMethod.EXTERNAL_PROGRAM:
|
|
||||||
Process process = new ProcessBuilder(loadedStation.getExternalProgramCommand(), nextMessagePath.toString()).start();
|
|
||||||
// TODO: make timeout a setting
|
|
||||||
if (!process.waitFor(5, TimeUnit.SECONDS)) {
|
|
||||||
throw new StationRunException("Timeout while running external program " + loadedStation.getExternalProgramCommand());
|
|
||||||
}
|
|
||||||
|
|
||||||
Pair<String, String> output = WindowsScheduler.captureProcessOutput(process);
|
|
||||||
if(process.exitValue() != 0) {
|
|
||||||
String message = "External program non-zero exit code. Exit code: " + process.exitValue() + ". stdout: " + output.getKey() + "\n\tstderr: " + output.getValue();
|
|
||||||
logger.log(Level.SEVERE, message);
|
|
||||||
throw new StationRunException(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case StationSettings.MessageMethod.SFTP:
|
case StationSettings.MessageMethod.SFTP:
|
||||||
//loadedStation.uploadNextMessageToSFTP();
|
//loadedStation.uploadNextMessageToSFTP();
|
||||||
JSch jsch = new JSch();
|
JSch jsch = new JSch();
|
||||||
@ -296,8 +271,6 @@ public class Main extends Application {
|
|||||||
throw new StationRunException(message);
|
throw new StationRunException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Completed station run");
|
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user