Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
module util
import os
// TODO `select` doesn't work with time.Duration for some reason
pub fn execute_with_timeout(cmd string, timeout i64) ?os.Result {
ch := chan os.Result{cap: 1}
spawn fn [cmd] (c chan os.Result) {
res := os.execute(cmd)
c <- res
}(ch)
select {
a := <-ch {
return a
}
// timeout {
// 1000 * time.millisecond {
// timeout * time.millisecond {
timeout * 1_000_000 {
return none
}
}
return os.Result{}
}