Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 3942f4e

Browse files
committed
test: 尝试修复打不开文件的问题
1 parent debb356 commit 3942f4e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/cli/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ if (options.reload) {
4747

4848
if (options.edit) {
4949
// 在 Windows 上,可以使用 'start' 命令; 在 macOS 上,使用 'open'; 在 Linux 上,使用 'xdg-open'
50-
const command =
51-
process.platform === 'win32'
52-
? 'start'
53-
: process.platform === 'darwin'
54-
? 'open'
55-
: 'xdg-open'
50+
const isWindows = process.platform === 'win32'
51+
const command = isWindows
52+
? `explorer "${envFilePath}"`
53+
: `open "${envFilePath}" || xdg-open "${envFilePath}"`
5654

57-
exec(`${command} ${envFilePath}`, (err) => {
55+
console.log(`执行命令: ${command}`)
56+
57+
exec(command, (err) => {
5858
if (err) {
5959
console.error(`执行出错: ${err}`)
6060
return

0 commit comments

Comments
 (0)