1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-03 07:29:37 +00:00

Fixed #827 problem with starting Vice64 on Windows by using ProcessBuilder.

This commit is contained in:
Jesper Gravgaard 2023-08-27 19:33:52 +02:00
parent f759c5c9c1
commit 6c8bab90c6

View File

@ -499,25 +499,34 @@ public class KickC implements Callable<Integer> {
// Execute the binary file if instructed // Execute the binary file if instructed
if(emulator != null) { if(emulator != null) {
List<String> emulatorCommand = new ArrayList<>();
emulatorCommand.addAll(Arrays.asList(emulator.split(" ")));
// Find commandline options for the emulator // Find commandline options for the emulator
String emuOptions = ""; if( emulator.equals("C64Debugger") ) {
if(emulator.equals("C64Debugger")) {
Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs"); Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs");
emuOptions = "-symbols " + viceSymbolsPath + " -autojmp -prg "; emulatorCommand.add("-symbol");
emulatorCommand.add(viceSymbolsPath.toString());
emulatorCommand.add("-autojmp");
emulatorCommand.add("-prg");
} }
// The program names used by VICE emulators // The program names used by VICE emulators
List<String> viceEmus = Arrays.asList("x64", "x64sc", "x128", "x64dtv", "xcbm2", "xcbm5x0", "xpet", "xplus4", "xscpu64", "xvic"); List<String> viceEmus = Arrays.asList("x64", "x64sc", "x128", "x64dtv", "xcbm2", "xcbm5x0", "xpet", "xplus4", "xscpu64", "xvic");
if(viceEmus.contains(emulator)) { if(viceEmus.contains(emulator)) {
Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs"); Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs");
emuOptions = "-moncommands " + viceSymbolsPath.toAbsolutePath().toString() + " "; emulatorCommand.add("-moncommands");
emulatorCommand.add(viceSymbolsPath.toAbsolutePath().toString());
} }
emulatorCommand.add(outputBinaryFilePath.toAbsolutePath().toString());
System.out.println("Executing " + outputBinaryFilePath + " using " + emulator); System.out.println("Executing " + outputBinaryFilePath + " using " + emulator);
String executeCommand = emulator + " " + emuOptions + outputBinaryFilePath.toAbsolutePath().toString();
if(verbose) { if(verbose) {
System.out.println("Executing command: " + executeCommand); System.out.println("Executing command: " + String.join(" ", emulatorCommand));
} }
try { try {
Process process = Runtime.getRuntime().exec(executeCommand); ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(emulatorCommand);
processBuilder.inheritIO();
Process process = processBuilder.start();
process.waitFor(); process.waitFor();
} catch(Throwable e) { } catch(Throwable e) {
System.err.println("Executing emulator failed! " + e.getMessage()); System.err.println("Executing emulator failed! " + e.getMessage());