From 75c289f526eb4e199d39ef8deba0ccab63b01f2d Mon Sep 17 00:00:00 2001 From: "Cameron (3539)" Date: Mon, 17 Feb 2025 18:58:16 -0500 Subject: [PATCH] Stop unknown coprocessor stats / no output from shell commands. (#1786) Join the threads and wait for them to finish reading the input/error streams before returning. --- .../main/java/org/photonvision/common/util/ShellExec.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java b/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java index 06ea32f14..59c3329cc 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java +++ b/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java @@ -145,8 +145,9 @@ public class ShellExec { exitCode = 0; if (wait) { try { - process.waitFor(); - exitCode = process.exitValue(); + exitCode = process.waitFor(); + errorGobbler.join(); + outputGobbler.join(); } catch (InterruptedException ignored) { } }