File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
app/src/main/kotlin/com/wire/android/util/logging Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -141,18 +141,17 @@ class LogFileWriterV2Impl(
141
141
Runtime .getRuntime().exec(" logcat -c" )
142
142
logcatProcess = Runtime .getRuntime().exec(" logcat" )
143
143
144
- val reader = logcatProcess!! .inputStream.bufferedReader()
145
-
146
- appLogger.i( " Starting to write log files, grabbing from logcat " )
147
- while (isActive) {
148
- val text = reader.readLine()
149
- if ( ! text.isNullOrBlank()) {
150
- val fileSize = writeLineToFile(text )
151
- emit(fileSize)
144
+ logcatProcess? .inputStream? .bufferedReader().use {
145
+ appLogger.i( " Starting to write log files, grabbing from logcat " )
146
+ while (isActive) {
147
+ val text = readlnOrNull()
148
+ if ( ! text.isNullOrBlank()) {
149
+ val fileSize = writeLineToFile( text)
150
+ emit(fileSize )
151
+ }
152
152
}
153
+ stopLogcatProcess()
153
154
}
154
- reader.close()
155
- stopLogcatProcess()
156
155
}.flowOn(Dispatchers .IO )
157
156
158
157
private fun stopLogcatProcess () {
You can’t perform that action at this time.
0 commit comments