|
fs::write(out_path, code).with_context(|| { |
|
format!("Failed to write generated client to {}", out_path.display()) |
|
})?; |
|
|
fs::write(out_path, code) is non-atomic. If the process is interrupted (SIGKILL/OOM/Ctrl-C) mid-write, out_path is left truncated/empty, silently corrupting a committed generated client.
Fix: write to a temp file and fs::rename into place.
sails/rs/client-gen-v2/src/lib.rs
Lines 180 to 183 in 645ce80
fs::write(out_path, code) is non-atomic. If the process is interrupted (SIGKILL/OOM/Ctrl-C) mid-write, out_path is left truncated/empty, silently corrupting a committed generated client.
Fix: write to a temp file and fs::rename into place.