Handle edge case exception of flush

This commit is contained in:
Mygod
2022-02-21 20:33:05 -05:00
parent ab6fef1329
commit f9db79cb1f

View File

@@ -5,6 +5,7 @@ import android.os.Build
import android.os.Looper import android.os.Looper
import android.os.Parcelable import android.os.Parcelable
import android.os.RemoteException import android.os.RemoteException
import android.system.ErrnoException
import android.system.Os import android.system.Os
import android.system.OsConstants import android.system.OsConstants
import androidx.collection.LongSparseArray import androidx.collection.LongSparseArray
@@ -236,6 +237,8 @@ class RootServer {
output.flush() output.flush()
} catch (e: IOException) { } catch (e: IOException) {
if (e.isEBADF) throw CancellationException().initCause(e) else throw e if (e.isEBADF) throw CancellationException().initCause(e) else throw e
} catch (e: ErrnoException) {
if (e.errno == OsConstants.EPIPE) throw CancellationException().initCause(e) else throw e
} }
Logger.me.d("Sent #$counter: $command") Logger.me.d("Sent #$counter: $command")
counter++ counter++