Removed unnecessary comments + yield. Changed timeUnit.lowercase -> chronoUnit.name

This commit is contained in:
Robinson 2021-12-14 23:08:20 -07:00
parent 1ec4408766
commit c4a125b498
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 5 additions and 8 deletions

View File

@ -408,9 +408,7 @@ class DeferredProcessResult internal constructor(private val process: Process,
// if we called await(), then save up the extra data (since calls to await() can also return data)
while (!channel.isEmpty) {
@Suppress("BlockingMethodInNonBlockingContext")
out.write(channel.receive().toInt())
yield()
}
}
@ -549,14 +547,13 @@ class DeferredProcessResult internal constructor(private val process: Process,
}
private fun getUnitsAsString(timeout: Long, timeUnit: TimeUnit): String {
var result = timeUnit.toString().lowercase()
if (timeout == 1L) {
val result = timeUnit.toChronoUnit().name
return if (timeout == 1L) {
// fix plurality
result = result.substring(0, result.length - 1)
result.substring(0, result.length - 1)
} else {
result
}
return result
}
private fun getExitCodeOrNull(process: Process?): Int? {