@commandgarden/cli 1.0.0 → 1.0.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/dist/main.js +24 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4910,11 +4910,33 @@ async function executeGuiStart(baseUrl, cgHome, appScript, opts) {
|
|
|
4910
4910
|
const child2 = spawn2("node", [appScript], { detached: true, stdio: "ignore" });
|
|
4911
4911
|
if (child2.pid) writeFileSync2(pidPath, String(child2.pid));
|
|
4912
4912
|
child2.unref();
|
|
4913
|
-
if (!opts.noOpen)
|
|
4913
|
+
if (!opts.noOpen) {
|
|
4914
|
+
const appUrl = `http://127.0.0.1:${appPort}`;
|
|
4915
|
+
for (let i = 0; i < 20; i++) {
|
|
4916
|
+
try {
|
|
4917
|
+
await fetch(appUrl);
|
|
4918
|
+
break;
|
|
4919
|
+
} catch {
|
|
4920
|
+
}
|
|
4921
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
4922
|
+
}
|
|
4923
|
+
openBrowser(appUrl);
|
|
4924
|
+
}
|
|
4914
4925
|
return `GUI started (PID: ${child2.pid ?? "unknown"}).`;
|
|
4915
4926
|
}
|
|
4916
|
-
if (!opts.noOpen) openBrowser(`http://127.0.0.1:${appPort}`);
|
|
4917
4927
|
const child = spawn2("node", [appScript], { stdio: "inherit" });
|
|
4928
|
+
if (!opts.noOpen) {
|
|
4929
|
+
const appUrl = `http://127.0.0.1:${appPort}`;
|
|
4930
|
+
for (let i = 0; i < 20; i++) {
|
|
4931
|
+
try {
|
|
4932
|
+
await fetch(appUrl);
|
|
4933
|
+
break;
|
|
4934
|
+
} catch {
|
|
4935
|
+
}
|
|
4936
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
4937
|
+
}
|
|
4938
|
+
openBrowser(appUrl);
|
|
4939
|
+
}
|
|
4918
4940
|
await new Promise((resolve) => child.on("exit", () => resolve()));
|
|
4919
4941
|
return "GUI stopped.";
|
|
4920
4942
|
}
|