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.
- package/package.json +1 -1
- package/src/index.js +10 -4
package/package.json
CHANGED
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
|
-
|
|
125
|
+
export function openBrowser(url, {
|
|
126
|
+
platformName = platform(),
|
|
127
|
+
spawnProcess = spawn,
|
|
128
|
+
} = {}) {
|
|
129
|
+
const command = platformName === "win32"
|
|
127
130
|
? ["explorer.exe", [url]]
|
|
128
|
-
:
|
|
131
|
+
: platformName === "darwin"
|
|
129
132
|
? ["open", [url]]
|
|
130
133
|
: ["xdg-open", [url]];
|
|
131
134
|
|
|
132
135
|
try {
|
|
133
|
-
const child =
|
|
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.
|