Commit cd63ce0
committed
Fix race condition
Fix race condition in get_mcli_path() at src/util/misc.rs:15. When tests ran in parallel,
multiple threads could attempt to create the .mcli directory simultaneously,
causing one to fail with "File exists".
The fix:
- Replaced expect() with proper error handling using pattern matching
- Gracefully ignores ErrorKind::AlreadyExists (safe when another thread created it)
- Preserves panic behavior for genuine errors (permissions, etc.)
- Only prints "Directory created" when actually successful
This makes the function thread-safe and eliminates the flaky test failure in GitHub Actions.1 parent cb5bc35 commit cd63ce0
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
0 commit comments