summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-04-17 00:41:31 +0200
committerewy <ewy0@protonmail.com>2026-04-17 00:41:31 +0200
commitc00cba98075ecddc82de4690574e06a9fa687ca3 (patch)
tree81e6ef8c7203479189c61e3abe7dbd20f7d0156d /main.go
parentb175e1541b56c0b17ca604128b6ea017ad7548b9 (diff)
make state creation asynchronous
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/main.go b/main.go
index 5a1bdd3..a393a40 100644
--- a/main.go
+++ b/main.go
@@ -19,6 +19,7 @@ import (
"pik/runner/shell"
"pik/search"
"pik/spool"
+ "sync"
)
var initializers = []model.Initializer{
@@ -58,12 +59,17 @@ func main() {
os.Exit(0)
}
+ wg := sync.WaitGroup{}
for _, i := range initializers {
- err := i.Init()
- if err != nil {
- _, _ = spool.Warn("%v\n", err)
- }
+ wg.Go(func() {
+ err := i.Init()
+ if err != nil {
+ _, _ = spool.Warn("%v\n", err)
+ }
+ })
}
+ wg.Wait()
+
here, err := os.Getwd()
if err != nil {
_, _ = spool.Warn("%v\n", err)