Use process builder

This commit is contained in:
business-goose 2022-03-21 20:42:11 +00:00
parent 61fa2063e5
commit c693373364

View file

@ -23,8 +23,11 @@ public class Command_updatetfm extends FreedomCommand {
try { try {
String command = String.format("bash -c \"cd %s; %s\"", directory, path); String command = String.format("bash -c \"cd %s; %s\"", directory, path);
System.out.println(command); System.out.println(command);
Process uptimeProc = Runtime.getRuntime().exec(command); ProcessBuilder proc = new ProcessBuilder(command);
uptimeProc.waitFor(); proc.redirectErrorStream(true);
Process process = proc.start();
process.waitFor();
System.out.println(proc.redirectOutput());
playerMsg("Updated TFM! Reloading..."); playerMsg("Updated TFM! Reloading...");
Utilities.adminAction(sender.getName(), "Update successful, reloading TFM...", false); Utilities.adminAction(sender.getName(), "Update successful, reloading TFM...", false);
Bukkit.dispatchCommand(sender, "plugman reload TotalFreedomMod"); Bukkit.dispatchCommand(sender, "plugman reload TotalFreedomMod");