From ec0772a9b018542fbebad3c9d801ce909d134d5a Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 16 Jul 2017 01:41:20 +0200 Subject: [PATCH] Added Async Shell Executor --- .../util/process/ShellAsyncExecutor.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/dorkbox/util/process/ShellAsyncExecutor.java diff --git a/src/dorkbox/util/process/ShellAsyncExecutor.java b/src/dorkbox/util/process/ShellAsyncExecutor.java new file mode 100644 index 0000000..5a57fcd --- /dev/null +++ b/src/dorkbox/util/process/ShellAsyncExecutor.java @@ -0,0 +1,24 @@ +package dorkbox.util.process; + +/** + * + */ +public +class ShellAsyncExecutor { + /** + * This is a convenience method to easily create a default process. Will immediately return, and does not wait for the process to finish + * + * @param executableName the name of the executable to run + * @param args the arguments for the executable + * + * @return true if the process ran successfully (exit value was 0), otherwise false + */ + public static void run(String executableName, String... args) { + ShellExecutor shell = new ShellExecutor(); + shell.setExecutable(executableName); + shell.addArguments(args); + shell.createReadWriterThreads(); + + shell.start(false); + } +}