Commit 8c74db5
committed
test: add tests for FIFO file content waiting logic
Add tests for _wait_for_file_content() to verify it correctly handles
both regular files and FIFOs. The existing FIFO test worked because it
started a writer thread before reading, ensuring the FIFO was ready.
However, with 1Password's asynchronously mounted FIFO files, the FIFO
may exist but not be immediately readable when first accessed. The old
code would open FIFOs directly in text mode, which could block
indefinitely waiting for a writer.
The new _wait_for_file_content() function addresses this by:
- Detecting FIFOs using stat.S_ISFIFO()
- Using select.select() to wait for the FIFO to become readable
- Reading content only when the FIFO is ready
These tests verify:
- Regular files continue to work correctly (no regression)
- FIFOs are properly handled with waiting logic for async-mounted files1 parent ad86b66 commit 8c74db5
1 file changed
+33
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments