From f89ba2e6ea83d11de236934e7de068e3b2adb18d Mon Sep 17 00:00:00 2001 From: Konloch Date: Wed, 2 Oct 2024 18:13:37 -0600 Subject: [PATCH] Started POC for External Decompiler Processes --- .../club/bytecodeviewer/util/ProcessUtils.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/ProcessUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/ProcessUtils.java index 1ac11ba1..c02154b7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/ProcessUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/ProcessUtils.java @@ -125,4 +125,22 @@ public class ProcessUtils }); } } + + public static void runDecompilerExternal(String[] args, boolean exceptionToGUI) throws IOException, InterruptedException + { + try + { + ProcessBuilder pb = new ProcessBuilder(args); + Process p = pb.start(); + BytecodeViewer.createdProcesses.add(p); + p.waitFor(); + } + catch (Exception e) + { + if(exceptionToGUI) + BytecodeViewer.handleException(e); + else + throw e; + } + } }