Commit f6bb096
committed
fs: honor flush option in writeFileSync utf8 fast path
The C++ utf8 fast path added in 4466dee does not perform an
fsync, but the gate routing writeFileSync through it did not consult
the flush option added in e01c1d7. As a result
writeFileSync(path, data, { encoding: 'utf8', flush: true }) wrote
without flushing, while the same call without an explicit encoding
flushed correctly. Skip the fast path when flush is requested.
appendFileSync delegates to writeFileSync and was affected the same
way. Extend the existing flush tests with the explicit-utf8-encoding
case for both; the new cases fail without this change.
Signed-off-by: Sam Attard <sattard@anthropic.com>1 parent 141a504 commit f6bb096
3 files changed
Lines changed: 30 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2844 | 2844 | | |
2845 | 2845 | | |
2846 | 2846 | | |
2847 | | - | |
2848 | | - | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
2849 | 2851 | | |
2850 | 2852 | | |
2851 | 2853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
50 | 63 | | |
51 | 64 | | |
52 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
50 | 63 | | |
51 | 64 | | |
52 | 65 | | |
| |||
0 commit comments