greprag 5.82.0 → 5.82.1
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/package.json +1 -1
- package/scripts/postinstall.js +29 -0
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -90,6 +90,35 @@ try {
|
|
|
90
90
|
console.error(' greprag postinstall: chip-spawn refresh skipped (' + err.message + ')');
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
// The Codex startup watcher was retired in v5.x, but upgrades left its login
|
|
94
|
+
// files in place. On Windows the leftover script loops every 5s, reruns the
|
|
95
|
+
// retired command, and appends its error to codex-watch.log forever (600 MB
|
|
96
|
+
// seen). Upgrading removes the whole retired surface: loop, login files, logs.
|
|
97
|
+
try {
|
|
98
|
+
const { codexStartupInfo } = require('../dist/commands/codex-startup.js');
|
|
99
|
+
const info = codexStartupInfo();
|
|
100
|
+
if (info.installed || (info.scriptPath && fs.existsSync(info.scriptPath))) {
|
|
101
|
+
if (process.platform === 'win32' && info.scriptPath) {
|
|
102
|
+
// Match only powershell.exe running this exact script via -File; a loose
|
|
103
|
+
// command-line match also hits any shell that merely mentions the path.
|
|
104
|
+
const script = info.scriptPath.replace(/'/g, "''");
|
|
105
|
+
require('child_process').spawnSync('powershell.exe', [
|
|
106
|
+
'-NoProfile', '-NonInteractive', '-Command',
|
|
107
|
+
`Get-CimInstance Win32_Process -Filter "Name='powershell.exe'" | Where-Object { $_.CommandLine -like ('*-File*"' + '${script}' + '"*') } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }`,
|
|
108
|
+
], { stdio: 'ignore', windowsHide: true });
|
|
109
|
+
}
|
|
110
|
+
for (const file of [info.path, info.scriptPath, info.legacyPath]) {
|
|
111
|
+
if (file) fs.rmSync(file, { force: true });
|
|
112
|
+
}
|
|
113
|
+
for (const log of ['codex-watch.log', 'codex-watch.err.log']) {
|
|
114
|
+
fs.rmSync(path.join(home, '.greprag', 'logs', log), { force: true });
|
|
115
|
+
}
|
|
116
|
+
refreshed.push('removed retired Codex startup watcher');
|
|
117
|
+
}
|
|
118
|
+
} catch (err) {
|
|
119
|
+
console.error(' greprag postinstall: retired watcher cleanup skipped (' + err.message + ')');
|
|
120
|
+
}
|
|
121
|
+
|
|
93
122
|
const changes = [...installed.map(s => '+' + s), ...refreshed];
|
|
94
123
|
if (changes.length > 0) {
|
|
95
124
|
const verb = installed.length > 0 ? 'Synced' : 'Refreshed';
|