package org.shedlang.compiler.util.processes; import java.io.IOException; import java.util.List; public class ProcessRunner { private ProcessRunner() { } /** * Run a process until it exits, inheriting standard IO from its parent * process. */ public static void runInheritIo(List args) throws InterruptedException, ProcessError { var process = startProcessInheritIo(args); var exitCode = process.waitFor(); if (exitCode != 0) { throw new ProcessExitError(exitCode); } } private static Process startProcessInheritIo(List args) throws ProcessError { try { return new ProcessBuilder(args) .inheritIO() .start(); } catch (IOException error) { throw new ProcessStartError(error); } } }