diff --git a/src/main/java/net/rubygrapefruit/platform/internal/WindowsProcessLauncher.java b/src/main/java/net/rubygrapefruit/platform/internal/WindowsProcessLauncher.java index 10c73d2..a0cf0aa 100755 --- a/src/main/java/net/rubygrapefruit/platform/internal/WindowsProcessLauncher.java +++ b/src/main/java/net/rubygrapefruit/platform/internal/WindowsProcessLauncher.java @@ -1,30 +1,30 @@ -package net.rubygrapefruit.platform.internal; - -import net.rubygrapefruit.platform.NativeException; -import net.rubygrapefruit.platform.ProcessLauncher; -import net.rubygrapefruit.platform.internal.jni.WindowsHandleFunctions; - -public class WindowsProcessLauncher implements ProcessLauncher { - private final ProcessLauncher launcher; - - public WindowsProcessLauncher(ProcessLauncher launcher) { - this.launcher = launcher; - } - - public Process start(ProcessBuilder processBuilder) throws NativeException { - FunctionResult result = new FunctionResult(); - WindowsHandleFunctions.markStandardHandlesUninheritable(result); - if (result.isFailed()) { - throw new NativeException(String.format("Could not start '%s': %s", processBuilder.command().get(0), - result.getMessage())); - } - try { - return launcher.start(processBuilder); - } finally { - WindowsHandleFunctions.restoreStandardHandles(result); - if (result.isFailed()) { - throw new NativeException(String.format("Could not restore process handles: %s", result.getMessage())); - } - } - } -} +package net.rubygrapefruit.platform.internal; + +import net.rubygrapefruit.platform.NativeException; +import net.rubygrapefruit.platform.ProcessLauncher; +import net.rubygrapefruit.platform.internal.jni.WindowsHandleFunctions; + +public class WindowsProcessLauncher implements ProcessLauncher { + private final ProcessLauncher launcher; + + public WindowsProcessLauncher(ProcessLauncher launcher) { + this.launcher = launcher; + } + + public Process start(ProcessBuilder processBuilder) throws NativeException { + FunctionResult result = new FunctionResult(); + WindowsHandleFunctions.markStandardHandlesUninheritable(result); + if (result.isFailed()) { + throw new NativeException(String.format("Could not start '%s': %s", processBuilder.command().get(0), + result.getMessage())); + } + try { + return launcher.start(processBuilder); + } finally { + WindowsHandleFunctions.restoreStandardHandles(result); + if (result.isFailed()) { + throw new NativeException(String.format("Could not restore process handles: %s", result.getMessage())); + } + } + } +} diff --git a/src/main/java/net/rubygrapefruit/platform/internal/jni/WindowsHandleFunctions.java b/src/main/java/net/rubygrapefruit/platform/internal/jni/WindowsHandleFunctions.java index 1fbe7d5..a8d530e 100755 --- a/src/main/java/net/rubygrapefruit/platform/internal/jni/WindowsHandleFunctions.java +++ b/src/main/java/net/rubygrapefruit/platform/internal/jni/WindowsHandleFunctions.java @@ -1,9 +1,9 @@ -package net.rubygrapefruit.platform.internal.jni; - -import net.rubygrapefruit.platform.internal.FunctionResult; - -public class WindowsHandleFunctions { - public static native void markStandardHandlesUninheritable(FunctionResult result); - - public static native void restoreStandardHandles(FunctionResult result); -} +package net.rubygrapefruit.platform.internal.jni; + +import net.rubygrapefruit.platform.internal.FunctionResult; + +public class WindowsHandleFunctions { + public static native void markStandardHandlesUninheritable(FunctionResult result); + + public static native void restoreStandardHandles(FunctionResult result); +}