Skip to content

Commit

Permalink
[manuf] Change log file move method in orchestrator
Browse files Browse the repository at this point in the history
shutil.move() is more robust than os.rename(). If the source and
destination are on different partitions, os.rename() throws "OSError:
[Errno 18] Invalid cross-device link".

Signed-off-by: Noah Moroze <[email protected]>
  • Loading branch information
nmoroze authored and milesdai committed Dec 3, 2024
1 parent cfa534a commit f22a505
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sw/host/provisioning/orchestrator/src/ot_dut.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import os
import re
import shutil
import tempfile
from dataclasses import dataclass

Expand Down Expand Up @@ -156,8 +157,8 @@ def run_cp(self) -> None:
self.device_id.update_base_id(cp_device_id)

self._make_log_dir()
os.rename(stdout_logfile, f"{self.log_dir}/cp_out.log.txt")
os.rename(stderr_logfile, f"{self.log_dir}/cp_err.log.txt")
shutil.move(stdout_logfile, f"{self.log_dir}/cp_out.log.txt")
shutil.move(stderr_logfile, f"{self.log_dir}/cp_err.log.txt")

self.cp_data = chip_probe_data
logging.info(f"CP logs saved to {self.log_dir}.")
Expand Down

0 comments on commit f22a505

Please sign in to comment.