From ab447b208163ca194b2873079f8ce59721acf31e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 21 Jan 2018 04:52:56 +0800 Subject: [PATCH] Fix new non-root shell crash --- superuser/src/main/java/com/topjohnwu/superuser/Shell.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superuser/src/main/java/com/topjohnwu/superuser/Shell.java b/superuser/src/main/java/com/topjohnwu/superuser/Shell.java index c35ab894..50416f52 100644 --- a/superuser/src/main/java/com/topjohnwu/superuser/Shell.java +++ b/superuser/src/main/java/com/topjohnwu/superuser/Shell.java @@ -86,7 +86,6 @@ private static void testShell(Shell shell) throws IOException { shell.STDIN.flush(); String s = new BufferedReader(new InputStreamReader(shell.STDOUT)).readLine(); if (TextUtils.isEmpty(s) || !s.contains("SHELL_TEST")) { - shell.close(); throw new IOException(); } } @@ -96,7 +95,6 @@ private static void testRootShell(Shell shell) throws IOException { shell.STDIN.flush(); String s = new BufferedReader(new InputStreamReader(shell.STDOUT)).readLine(); if (TextUtils.isEmpty(s) || !s.contains("uid=0")) { - shell.close(); throw new IOException(); } } @@ -150,6 +148,7 @@ private static Shell getShell(ShellContainer container) throws NoShellException } catch (IOException e) { // Shell initialize failed Utils.stackTrace(e); + shell = null; } } @@ -167,6 +166,7 @@ private static Shell getShell(ShellContainer container) throws NoShellException } catch (IOException e) { // Shell initialize failed Utils.stackTrace(e); + shell = null; } }