@aiyiran/myclaw 1.1.21 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +17 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1837,6 +1837,23 @@ async function runServer(name) {
|
|
|
1837
1837
|
try { fs.unlinkSync(pidFile); } catch (e) { }
|
|
1838
1838
|
}
|
|
1839
1839
|
|
|
1840
|
+
// 0.5 清理竞争者:/root/sync_workspace.py
|
|
1841
|
+
const rivalPath = '/root/sync_workspace.py';
|
|
1842
|
+
try {
|
|
1843
|
+
// 先杀掉所有运行该脚本的进程
|
|
1844
|
+
try {
|
|
1845
|
+
execSyncLocal('pkill -f "' + rivalPath + '" 2>/dev/null || true', { shell: true, stdio: 'pipe' });
|
|
1846
|
+
console.log('[Server] 已终止竞争进程: ' + rivalPath);
|
|
1847
|
+
} catch (e) { /* 无进程时忽略 */ }
|
|
1848
|
+
// 再删除文件
|
|
1849
|
+
if (fs.existsSync(rivalPath)) {
|
|
1850
|
+
fs.unlinkSync(rivalPath);
|
|
1851
|
+
console.log('[Server] 已删除竞争脚本: ' + rivalPath);
|
|
1852
|
+
}
|
|
1853
|
+
} catch (e) {
|
|
1854
|
+
console.log('[Server] 清理竞争者失败(可忽略): ' + e.message);
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1840
1857
|
// 1. 创建目标目录
|
|
1841
1858
|
if (!fs.existsSync(targetDir)) {
|
|
1842
1859
|
fs.mkdirSync(targetDir, { recursive: true });
|