MCPcopy Create free account
hub / github.com/jetify-com/devbox / lockFile

Function lockFile

internal/services/manager.go:379–399  ·  view source on GitHub ↗
(file *os.File)

Source from the content-addressed store, hash-verified

377}
378
379func lockFile(file *os.File) error {
380 lockResult := make(chan error)
381
382 go func() {
383 err := syscall.Flock(int(file.Fd()), syscall.LOCK_EX)
384 lockResult <- err
385 }()
386
387 select {
388 case err := <-lockResult:
389 if err != nil {
390 file.Close()
391 return fmt.Errorf("failed to lock file: %w", err)
392 }
393 return nil
394
395 case <-time.After(fileLockTimeout):
396 file.Close()
397 return fmt.Errorf("process-compose file lock timed out after %d seconds", fileLockTimeout/time.Second)
398 }
399}

Callers 1

openGlobalConfigFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected