rechrome 1.11.1 → 1.11.2

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/rech.js +8 -2
  3. package/rech.ts +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rechrome",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/snomiao/rechrome.git"
package/rech.js CHANGED
@@ -678,11 +678,17 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
678
678
  while (true) {
679
679
  const found = await findInstalledExtension(profileDir);
680
680
  if (found) { extId = found.id; break; }
681
+ console.log(`\n Extension not found in profile: ${profileDisplay}`);
682
+ console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
683
+ // Non-TTY (agent/pipe) can't install an extension interactively, and `ask` doesn't block on an exhausted stdin queue —
684
+ // looping here would spawn `open` per iteration until the OS runs out of resources. Fail fast instead.
685
+ if (!isTTY) {
686
+ console.error(` Non-TTY: cannot install extension interactively — aborting`);
687
+ return null;
688
+ }
681
689
  const setupHtmlPath = join(RECH_HOME_DIR, "setup.html");
682
690
  mkdirSync(RECH_HOME_DIR, { recursive: true });
683
691
  await Bun.write(setupHtmlPath, buildSetupHtml(EXTENSION_DIST_DIR, profileDisplay));
684
- console.log(`\n Extension not found in profile: ${profileDisplay}`);
685
- console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
686
692
  console.log(`\n Opening install guide in your browser...`);
687
693
  Bun.spawn(["open", setupHtmlPath], { stdout: "ignore", stderr: "ignore" });
688
694
  await ask("\n Press Enter after loading the extension to retry...");
package/rech.ts CHANGED
@@ -678,11 +678,17 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
678
678
  while (true) {
679
679
  const found = await findInstalledExtension(profileDir);
680
680
  if (found) { extId = found.id; break; }
681
+ console.log(`\n Extension not found in profile: ${profileDisplay}`);
682
+ console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
683
+ // Non-TTY (agent/pipe) can't install an extension interactively, and `ask` doesn't block on an exhausted stdin queue —
684
+ // looping here would spawn `open` per iteration until the OS runs out of resources. Fail fast instead.
685
+ if (!isTTY) {
686
+ console.error(` Non-TTY: cannot install extension interactively — aborting`);
687
+ return null;
688
+ }
681
689
  const setupHtmlPath = join(RECH_HOME_DIR, "setup.html");
682
690
  mkdirSync(RECH_HOME_DIR, { recursive: true });
683
691
  await Bun.write(setupHtmlPath, buildSetupHtml(EXTENSION_DIST_DIR, profileDisplay));
684
- console.log(`\n Extension not found in profile: ${profileDisplay}`);
685
- console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
686
692
  console.log(`\n Opening install guide in your browser...`);
687
693
  Bun.spawn(["open", setupHtmlPath], { stdout: "ignore", stderr: "ignore" });
688
694
  await ask("\n Press Enter after loading the extension to retry...");