-
-
Notifications
You must be signed in to change notification settings - Fork 348
Closed
Description
the doc says that WriteFile() is equivalent to > .
but when I use WriteFile() with a file which contains content already, it will not truncate the file but will append it to the begining! overwriting only the bytes I write.
cat file.txt
result: ttttttttttt
script.Echo("zzz").WriteFile("file.txt")
result: zzztttttttt
I think we have to use O_TRUNC here
Line 112 in 32cf7a7
| return p.writeOrAppendFile(fileName, os.O_RDWR|os.O_CREATE) |
tested in windows 7 with golang v1.16.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels