Write current process PID to file
(&self)
| 31 | |
| 32 | /// Write current process PID to file |
| 33 | pub fn write_pid(&self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> { |
| 34 | let pid_file = self.tsk_env.pid_file(); |
| 35 | let pid = process::id(); |
| 36 | |
| 37 | let mut file = fs::File::create(&pid_file)?; |
| 38 | file.write_all(pid.to_string().as_bytes())?; |
| 39 | |
| 40 | Ok(()) |
| 41 | } |
| 42 | |
| 43 | /// Read PID from file |
| 44 | pub fn read_pid(&self) -> Option<u32> { |