Matt Nelson
10/02/2024, 10:30 AMFile.deleteOnExit()
). Anyone know of a K/N API that I can use to build off of that would provide similar functionality?jw
10/02/2024, 12:30 PMjw
10/02/2024, 12:31 PMjw
10/02/2024, 12:32 PMMatt Nelson
10/02/2024, 1:05 PMAdam S
10/02/2024, 3:05 PMdefer {}
, for when the memory scope is finished, which is similar
https://kotlinlang.org/api/core/kotlin-stdlib/kotlinx.cinterop/-autofree-scope/#-2026372596%2FFunctions%2F1938390331jw
10/02/2024, 3:10 PMMatt Nelson
10/02/2024, 3:14 PMFile.deleteOnExit()
where the hook executes when the VM shuts down. Looking into using signal handlers atm.Matt Nelson
10/08/2024, 9:23 AMfinalization-hook
is a suspend function, so I could do something like?
GlobalScope.launch {
withFinalizationHook(
hook = ::executeDeleteOnExit,
block = { delay(Duration.INFINITE) }
)
}
jw
10/08/2024, 3:06 PMMatt Nelson
10/09/2024, 4:03 PMSIGABRT
, but it wasn't catching it. Ended up just using sigaction
for Unix which is working. Still have to figure out Windows.
nativeMain
https://github.com/05nelsonm/kmp-tor-resource/blob/master/library/resource-noexec-tor/src/nativeMain/kotlin/io/matthewnelson/kmp/tor/resource/noexec/tor/internal/DeleteOnExit.kt
unixMain
https://github.com/05nelsonm/kmp-tor-resource/blob/master/library/resource-noexec-[…]nelson/kmp/tor/resource/noexec/tor/internal/DeleteOnExitUnix.kt