Skip to content

Commit

Permalink
test: 尝试修复打不开文件的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
danni-cool committed Dec 1, 2024
1 parent debb356 commit 3942f4e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ if (options.reload) {

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

exec(`${command} ${envFilePath}`, (err) => {
console.log(`执行命令: ${command}`)

exec(command, (err) => {
if (err) {
console.error(`执行出错: ${err}`)
return
Expand Down

0 comments on commit 3942f4e

Please sign in to comment.