small refactor
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package com.infendro.shell
|
||||
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
import node.childProcess.ExecOptions
|
||||
import node.childProcess.exec
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
|
||||
internal actual suspend fun execute(
|
||||
command: Array<String>,
|
||||
@@ -13,7 +13,7 @@ internal actual suspend fun execute(
|
||||
val options = ExecOptions.invoke(cwd = directory)
|
||||
exec(command, options) { error, stdout, stderr ->
|
||||
val code = if (error == null) 0 else error.code!!.toInt()
|
||||
val value = if (error == null) stdout else stderr
|
||||
val value = (if (error == null) stdout else stderr) as String
|
||||
continuation.resume(Shell.Result(code, value))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user