v0.2.2 fixes: split only text sources, report a mode change once, don't block on open
Test / test (push) Canceled after 0s

This commit is contained in:
lixen committed 2026-10-03 23:47:22 -04:00
1 parent 2a47be454d
commit 4d3c91406b
21 files changed
+368 -62

No files matched your search

+8 -1
View File
@@ -68,7 +68,7 @@ func readConfigFile(ctx context.Context, path string, opts fileSettings) (*fileS
if !info.Mode().IsRegular() {
return nil, wrapError(ErrFileAccess, fmt.Errorf("config must be a regular file"))
}
file, err := os.Open(path)
file, err := openConfig(path)
if err != nil {
return nil, wrapError(ErrFileAccess, err)
}
@@ -113,6 +113,13 @@ func readConfigFile(ctx context.Context, path string, opts fileSettings) (*fileS
return &fileSnapshot{data, after, sha256.Sum256(data)}, nil
}
// openConfig opens without blocking: a FIFO swapped in after the Stat cannot
// hang open(2), and a regular-looking file whose reads block (/proc/kmsg)
// fails its read instead
func openConfig(path string) (*os.File, error) {
return os.OpenFile(path, os.O_RDONLY|openNonBlock, 0)
}
func parseFile(snapshot *fileSnapshot) (map[string]any, []string, error) {
root, err := toml.NewParser(snapshot.data).Parse()
if err != nil {