stdlib: Add exitProcess function
This commit is contained in:
@@ -408,6 +408,11 @@ task array_to_any(type: RunKonanTest) {
|
||||
source = "codegen/basics/array_to_any.kt"
|
||||
}
|
||||
|
||||
task runtime_basic_exit(type: RunKonanTest) {
|
||||
source = "runtime/basic/exit.kt"
|
||||
expectedExitStatus = 42
|
||||
}
|
||||
|
||||
task hello0(type: RunKonanTest) {
|
||||
goldValue = "Hello, world!\n"
|
||||
source = "runtime/basic/hello0.kt"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import kotlin.system.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
exitProcess(42)
|
||||
}
|
||||
@@ -66,4 +66,8 @@ void Kotlin_interop_free(void* ptr) {
|
||||
konan::free(ptr);
|
||||
}
|
||||
|
||||
void Kotlin_system_exitProcess(KInt status) {
|
||||
exit(status);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package kotlin.system
|
||||
|
||||
/**
|
||||
* Terminates the currently running process.
|
||||
* The argument serves as a status code; by convention,
|
||||
* a nonzero status code indicates abnormal termination.
|
||||
*
|
||||
* This method never returns normally.
|
||||
*/
|
||||
@SymbolName("Kotlin_system_exitProcess")
|
||||
public external fun exitProcess(status: Int): Nothing
|
||||
Reference in New Issue
Block a user