Skip to main content

replace_file

Function replace_file 

Source
pub fn replace_file(path: &Path, bytes: &[u8]) -> Result<()>
Expand description

Replace the executable at path with bytes, even while it runs: a running program keeps the old file (unix) or can be renamed but not overwritten (Windows), so the new one is written beside it and moved into its place. Running copies go on with the old code until they are restarted.

The staging file is removed on every error.