Fix more stream closed detections

This commit is contained in:
Mygod
2021-06-08 14:03:09 -04:00
parent 2fdb0ee909
commit b887569cee

View File

@@ -12,6 +12,7 @@ import android.util.*
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
import java.io.IOException import java.io.IOException
import java.util.*
class NoShellException(cause: Throwable) : Exception("Root missing", cause) class NoShellException(cause: Throwable) : Exception("Root missing", cause)
@@ -252,4 +253,5 @@ inline fun <reified T : Parcelable> ByteArray.toParcelable(classLoader: ClassLoa
} }
// Stream closed caused in NullOutputStream // Stream closed caused in NullOutputStream
val IOException.isEBADF get() = message == "Stream closed" || (cause as? ErrnoException)?.errno == OsConstants.EBADF val IOException.isEBADF get() = (cause as? ErrnoException)?.errno == OsConstants.EBADF ||
message?.lowercase(Locale.ENGLISH) == "stream closed"