Commit df00805
committed
fix(core): harden try_rmtree with retry and rename for Windows
On Windows, shutil.rmtree fails when files are locked by antivirus
or git handles. The current fallback (reserve_script for lazy delete)
is useless in cm-cli where there is no restart cycle, causing
reinstall to fail with "Already exists".
3-tier deletion strategy:
1. Retry rmtree 3x with 1s delay (handles transient locks)
2. Rename to .trash_* then delete (moves out of scan path)
3. Lazy delete via reserve_script (ComfyUI GUI fallback)
After rename, lazy-delete targets the .trash_* path (not original),
so the original path is clear for subsequent clone/install.1 parent 41ab628 commit df00805
2 files changed
Lines changed: 50 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1854 | 1854 | | |
1855 | 1855 | | |
1856 | 1856 | | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
1857 | 1868 | | |
1858 | | - | |
1859 | | - | |
1860 | | - | |
1861 | | - | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
1862 | 1883 | | |
1863 | 1884 | | |
1864 | 1885 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1833 | 1833 | | |
1834 | 1834 | | |
1835 | 1835 | | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
1836 | 1847 | | |
1837 | | - | |
1838 | | - | |
1839 | | - | |
1840 | | - | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
1841 | 1862 | | |
1842 | 1863 | | |
1843 | 1864 | | |
| |||
0 commit comments