RootShell: stop if we can't start

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-01-09 15:23:26 +01:00 committed by Samuel Holland
parent 23c09eb655
commit 643b698f30

View File

@ -112,6 +112,7 @@ public class RootShell {
} }
public synchronized void start() throws IOException, NoRootException { public synchronized void start() throws IOException, NoRootException {
try {
if (isRunning()) if (isRunning())
return; return;
if (!localBinaryDir.isDirectory() && !localBinaryDir.mkdirs()) if (!localBinaryDir.isDirectory() && !localBinaryDir.mkdirs())
@ -145,6 +146,10 @@ public class RootShell {
} }
throw new IOException("Shell failed to start: " + process.exitValue()); throw new IOException("Shell failed to start: " + process.exitValue());
} }
} catch (final IOException | NoRootException e) {
stop();
throw e;
}
} }
public synchronized void stop() throws IOException { public synchronized void stop() throws IOException {