diff options
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/commands')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/commands/Executor.kt | 11 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/commands/Tinc.kt | 2 |
2 files changed, 2 insertions, 11 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/commands/Executor.kt b/app/src/main/java/org/pacien/tincapp/commands/Executor.kt index 160f0cd..c93de64 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Executor.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Executor.kt | |||
@@ -3,7 +3,6 @@ package org.pacien.tincapp.commands | |||
3 | import java.io.BufferedReader | 3 | import java.io.BufferedReader |
4 | import java.io.IOException | 4 | import java.io.IOException |
5 | import java.io.InputStreamReader | 5 | import java.io.InputStreamReader |
6 | import java.util.* | ||
7 | 6 | ||
8 | /** | 7 | /** |
9 | * @author pacien | 8 | * @author pacien |
@@ -29,15 +28,7 @@ internal object Executor { | |||
29 | fun call(cmd: Command): List<String> { | 28 | fun call(cmd: Command): List<String> { |
30 | val proc = ProcessBuilder(cmd.asList()).start() | 29 | val proc = ProcessBuilder(cmd.asList()).start() |
31 | val outputReader = BufferedReader(InputStreamReader(proc.inputStream)) | 30 | val outputReader = BufferedReader(InputStreamReader(proc.inputStream)) |
32 | 31 | return outputReader.readLines() | |
33 | var line: String? = outputReader.readLine() | ||
34 | val list = LinkedList<String>() | ||
35 | while (line != null) { | ||
36 | line = outputReader.readLine() | ||
37 | list.add(line) | ||
38 | } | ||
39 | |||
40 | return list | ||
41 | } | 32 | } |
42 | 33 | ||
43 | } | 34 | } |
diff --git a/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt b/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt index 22cbe71..e8ebb21 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt | |||
@@ -30,7 +30,7 @@ object Tinc { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | @Throws(IOException::class) | 32 | @Throws(IOException::class) |
33 | fun dumpNodes(netName: String, reachable: Boolean): List<String> = | 33 | fun dumpNodes(netName: String, reachable: Boolean = false): List<String> = |
34 | Executor.call( | 34 | Executor.call( |
35 | if (reachable) newCommand(netName).withArguments("dump", "reachable", "nodes") | 35 | if (reachable) newCommand(netName).withArguments("dump", "reachable", "nodes") |
36 | else newCommand(netName).withArguments("dump", "nodes")) | 36 | else newCommand(netName).withArguments("dump", "nodes")) |