diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-08-06 17:18:47 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-08-06 17:18:47 +0100 |
| commit | 31c83d816e104ecd27e2aed0bb3cd11ad16759f1 (patch) | |
| tree | 58d45060210d2efa17eab78ce3c8e96f968d1d61 /src/test/java/org/zwobble/couscous/tests/backends/Processes.java | |
| parent | 54cd15fbeb33ddcbed0b6635d2069a0380156e16 (diff) | |
Cache execution of C# as well as compilation
Diffstat (limited to 'src/test/java/org/zwobble/couscous/tests/backends/Processes.java')
| -rw-r--r-- | src/test/java/org/zwobble/couscous/tests/backends/Processes.java | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/test/java/org/zwobble/couscous/tests/backends/Processes.java b/src/test/java/org/zwobble/couscous/tests/backends/Processes.java deleted file mode 100644 index 7b139df..0000000 --- a/src/test/java/org/zwobble/couscous/tests/backends/Processes.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.zwobble.couscous.tests.backends; - -import com.google.common.base.Charsets; -import com.google.common.io.CharStreams; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.file.Path; -import java.util.List; - -public class Processes { - public static String run(List<String> arguments) throws IOException, InterruptedException { - return run(arguments, null); - } - - public static String run(List<String> arguments, Path directoryPath) throws IOException, InterruptedException { - Process process = new ProcessBuilder(arguments.toArray(new String[arguments.size()])) - .directory(directoryPath == null ? null : directoryPath.toFile()) - .start(); - - int exitCode = process.waitFor(); - String output = readString(process.getInputStream()).trim(); - String stderrOutput = readString(process.getErrorStream()); - if (exitCode != 0) { - throw new RuntimeException("stderr was: " + stderrOutput); - } else { - return output; - } - } - - private static String readString(final InputStream stream) throws IOException { - return CharStreams.toString(new InputStreamReader(stream, Charsets.UTF_8)); - } -} |
