omnirush 0.3.0 → 0.3.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/assets/extensions/omnirush/auth.js +21 -12
- package/package.json +1 -1
- package/src/bin.js +1 -1
|
@@ -400,20 +400,29 @@ export function createRefresher({ dir, origin, fetchImpl, now = () => Date.now()
|
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
/** Best-effort browser open
|
|
403
|
+
/** Best-effort browser open. NEVER throws or crashes: the spawned child's
|
|
404
|
+
* 'error' event is always handled (ENOENT on a headless Linux box would
|
|
405
|
+
* otherwise take the CLI down — Foxtran's login crash). Linux tries a
|
|
406
|
+
* chain of openers; if all fail the caller's printed URL still works. */
|
|
404
407
|
export function openBrowser(url) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
spawn(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if (process.platform === "win32") {
|
|
411
|
-
spawn("cmd", ["/c", "start", "", url], { detached: true, stdio: "ignore" }).unref();
|
|
408
|
+
const spawnSafe = (cmd, args) => {
|
|
409
|
+
try {
|
|
410
|
+
const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
|
|
411
|
+
child.on("error", () => undefined);
|
|
412
|
+
child.unref();
|
|
412
413
|
return true;
|
|
414
|
+
} catch {
|
|
415
|
+
return false;
|
|
413
416
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
417
|
+
};
|
|
418
|
+
if (process.platform === "darwin") {
|
|
419
|
+
return spawnSafe("open", [url]);
|
|
420
|
+
}
|
|
421
|
+
if (process.platform === "win32") {
|
|
422
|
+
return spawnSafe("cmd", ["/c", "start", "", url]);
|
|
423
|
+
}
|
|
424
|
+
for (const opener of ["xdg-open", "sensible-browser", "gnome-open", "kde-open", "wslview"]) {
|
|
425
|
+
if (spawnSafe(opener, [url])) return true;
|
|
418
426
|
}
|
|
427
|
+
return false;
|
|
419
428
|
}
|
package/package.json
CHANGED
package/src/bin.js
CHANGED
|
@@ -513,7 +513,7 @@ if (cmd === "login") await cmdLogin(argv.slice(1));
|
|
|
513
513
|
else if (cmd === "logout") await cmdLogout();
|
|
514
514
|
else if (cmd === "whoami") await cmdWhoami();
|
|
515
515
|
else if (cmd === "doctor") await cmdDoctor();
|
|
516
|
-
else if (cmd === "--version" || cmd === "-v") console.log("omnirush 0.3.
|
|
516
|
+
else if (cmd === "--version" || cmd === "-v") console.log("omnirush 0.3.1");
|
|
517
517
|
else if (cmd === "collect") await cmdCollect(argv.slice(1));
|
|
518
518
|
else if (cmd === undefined || cmd === "run") await cmdRun();
|
|
519
519
|
else {
|