jakt
jakt copied to clipboard
runtime: Do not error when writing zero bytes to a File
File::write might get an empty array, so fwrite() returning zero does not always mean that an error occurred. Better check that an error actually occurred before returning an Error(errno=0).
Hello!
One or more of the commit messages in this PR do not match the Jakt code submission policy, please check the lint_commits
CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.
How about we check for 0 before even calling fwrite
, and early return if so?
Seems like a better option, since that's the only other case where fwrite() can return zero without having an error.