collabdocchat 1.2.3 → 1.2.4
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/bin/cli.js +18 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -14,10 +14,24 @@ const isWindows = platform() === 'win32';
|
|
|
14
14
|
|
|
15
15
|
// 打开浏览器
|
|
16
16
|
function openBrowser(url) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
try {
|
|
18
|
+
if (isWindows) {
|
|
19
|
+
// Windows: 使用 start 命令,需要添加空标题
|
|
20
|
+
spawn('cmd', ['/c', 'start', '""', url], {
|
|
21
|
+
stdio: 'ignore',
|
|
22
|
+
detached: true,
|
|
23
|
+
shell: true
|
|
24
|
+
}).unref();
|
|
25
|
+
} else if (platform() === 'darwin') {
|
|
26
|
+
// macOS
|
|
27
|
+
spawn('open', [url], { stdio: 'ignore', detached: true }).unref();
|
|
28
|
+
} else {
|
|
29
|
+
// Linux
|
|
30
|
+
spawn('xdg-open', [url], { stdio: 'ignore', detached: true }).unref();
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.log(`\n⚠️ 无法自动打开浏览器,请手动访问: ${url}`);
|
|
34
|
+
}
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
// 检查是否在正确的目录
|