compiler_wrapper: fix write() races

If we make this function write its data atomically to the RUSAGE file,
we can have all compilations log to this file, which would allow us to
trivially log all of the build info for a given tryjob.

BUG=chromium:1054897
TEST=nocturne-llvm-next-toolchain-tryjob. Local --nousepkg
build_packages produced a file with 0 torn lines.

Change-Id: Ic6b014af11e812111fa21a56133bbe1b6b31f954
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2066710
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
1 file changed