@apmantza/greedysearch-pi 1.0.3 → 1.0.5
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/launch.mjs +9 -4
- package/package.json +1 -1
package/launch.mjs
CHANGED
|
@@ -154,11 +154,16 @@ async function main() {
|
|
|
154
154
|
// Already running?
|
|
155
155
|
const existing = isRunning();
|
|
156
156
|
if (existing) {
|
|
157
|
-
console.log(`GreedySearch Chrome already running (pid ${existing}, port ${PORT}).`);
|
|
158
|
-
// Ensure redirect is in place (idempotent)
|
|
159
157
|
const ready = await writePortFile(5000);
|
|
160
|
-
if (ready) {
|
|
161
|
-
|
|
158
|
+
if (ready) {
|
|
159
|
+
console.log(`GreedySearch Chrome already running (pid ${existing}, port ${PORT}).`);
|
|
160
|
+
redirectCdpToGreedySearch();
|
|
161
|
+
console.log('DevToolsActivePort redirected.');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
// Stale PID — process alive but not Chrome on port 9223. Fall through to fresh launch.
|
|
165
|
+
console.log(`Stale PID ${existing} detected (not Chrome on port ${PORT}) — launching fresh.`);
|
|
166
|
+
try { unlinkSync(PID_FILE); } catch {}
|
|
162
167
|
}
|
|
163
168
|
|
|
164
169
|
const CHROME_EXE = process.env.CHROME_PATH || findChrome();
|
package/package.json
CHANGED