diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-22 17:10:44 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-22 17:10:44 +0200 |
| commit | 3a28945131e151e8cc345bff09cd9b8bc017b62b (patch) | |
| tree | a2a478e8ec356e668ae3d90cb34c36983024b665 | |
| parent | d398497d81f09b3011d52ff78a42f9b67d93aaee (diff) | |
add locks so we don't panic
| -rw-r--r-- | runner/shell/shell.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runner/shell/shell.go b/runner/shell/shell.go index c9d7134..3c4bddb 100644 --- a/runner/shell/shell.go +++ b/runner/shell/shell.go @@ -13,6 +13,7 @@ import ( "pik/spool" "slices" "strings" + "sync" ) //TODO: Clean up shell selection? Maybe default to bash? @@ -33,6 +34,7 @@ var Runner = &shell{ type shell struct { Locations map[string]string + lock sync.Mutex } func (s *shell) Wants(f fs.FS, file string, entry fs.DirEntry) (bool, error) { @@ -67,7 +69,9 @@ func (s *shell) Find(shell string) (string, error) { } if p, err := exec.LookPath(shell); err == nil { + s.lock.Lock() s.Locations[shell] = p + s.lock.Unlock() return shell, nil } else { return "", err |
