aixlab-skills 0.1.1 → 0.1.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aixlab-skills",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Secure installer for owned AixLab agent Skills",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -122,15 +122,21 @@ async function requestJson(host, path, { method = "GET", token, body, statuses =
122
122
  return { status: response.status, payload };
123
123
  }
124
124
 
125
- function openBrowser(url) {
126
- const command = platform() === "win32"
125
+ export function openBrowser(url, {
126
+ platformName = platform(),
127
+ spawnProcess = spawn,
128
+ } = {}) {
129
+ const command = platformName === "win32"
127
130
  ? ["explorer.exe", [url]]
128
- : platform() === "darwin"
131
+ : platformName === "darwin"
129
132
  ? ["open", [url]]
130
133
  : ["xdg-open", [url]];
131
134
 
132
135
  try {
133
- const child = spawn(command[0], command[1], { detached: true, stdio: "ignore" });
136
+ const child = spawnProcess(command[0], command[1], { detached: true, stdio: "ignore" });
137
+ child.once("error", () => {
138
+ // Printing the URL is sufficient when the desktop opener is unavailable.
139
+ });
134
140
  child.unref();
135
141
  } catch {
136
142
  // Printing the URL is sufficient when the desktop opener is unavailable.