vaskir
06/04/2020, 1:29 PM<http://Dispatchers.IO|Dispatchers.IO>pawegio
06/04/2020, 1:31 PMstreetsofboston
06/04/2020, 1:34 PM<http://Dispatchers.IO|Dispatchers.IO> there.
Move the call to `withContext down to just before/around calling process.waitFor should get rid of the warning. Or otherwise, just suppress the warning 🙂vaskir
06/04/2020, 1:37 PMvaskir
06/04/2020, 1:37 PMvaskir
06/04/2020, 1:37 PMwaitFor is not cancellable.vaskir
06/04/2020, 1:37 PMstreetsofboston
06/04/2020, 1:38 PMwithContext(<http://Dispatchers.IO|Dispatchers.IO>) call.streetsofboston
06/04/2020, 1:39 PMvaskir
06/04/2020, 1:40 PMvaskir
06/04/2020, 1:41 PMstreetsofboston
06/04/2020, 1:41 PMstreetsofboston
06/04/2020, 1:42 PMvaskir
06/04/2020, 1:42 PMmarstran
06/04/2020, 1:43 PMwithContext ? Can't you just do this:
launch(<http://Dispatchers.IO|Dispatchers.IO>) {
process.waitFor(....)
}vaskir
06/04/2020, 1:43 PMvaskir
06/04/2020, 1:44 PMvaskir
06/04/2020, 1:44 PMwithContext is what is recommended to use, isn't it?streetsofboston
06/04/2020, 1:45 PMsuspendCancellableCoroutine<Unit> { cont ->
val handle = startBlockingProcess(....)
cont.invokeOnCancelation { handle.cancel() }
cont.resume(Unit)
}streetsofboston
06/04/2020, 1:45 PMhandle represents a process that can be cancelled by calling cancel() or something similar on it)vaskir
06/04/2020, 1:45 PMvaskir
06/04/2020, 1:45 PMstreetsofboston
06/04/2020, 1:48 PMhandle.awaitResult() or handle.join() or what-ever would be the correct function name, just before calling cont.resume(Unit)vaskir
06/04/2020, 2:42 PMstreetsofboston
06/04/2020, 2:43 PMcont.resumeWithException(e)vaskir
06/04/2020, 2:44 PMstreetsofboston
06/04/2020, 2:45 PMcont.resume(errorData))vaskir
06/04/2020, 2:47 PM