From 93b33ce37e21658a5db0d73725e27d820446b0af Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 9 Jan 2023 09:58:51 -0500 Subject: [PATCH] Capturing output of remote exec() to file. --- src/discord/handlers/DevRequestHandler.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/discord/handlers/DevRequestHandler.java b/src/discord/handlers/DevRequestHandler.java index 292017ee..492d448f 100644 --- a/src/discord/handlers/DevRequestHandler.java +++ b/src/discord/handlers/DevRequestHandler.java @@ -63,7 +63,17 @@ public class DevRequestHandler { } processBuilder = new ProcessBuilder("/bin/sh", "-c", commandString + " " + commandArgument); + outFile = new File("devLastOut"); + if (outFile.exists()) + outFile.delete(); + + try { + outFile.createNewFile(); + } catch (IOException e) { + throw new RuntimeException(e); + } + logString = String.join(" ",processBuilder.command().toArray(new String[0])); try {