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

Commit 90fac65

Browse files
fix: wrap 'npm ls -g' call in try/catch so it doesn't fail in Windows
1 parent df37f15 commit 90fac65

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,16 @@ async function isCLIInstalled(path: string) {
107107
return true
108108
} catch (error) {
109109
// check of the cli is installed globally
110-
const output = execSync('npm ls -g', { encoding: 'utf-8' })
111-
if (output.includes('@wdio/cli')) {
112-
return true
110+
// wrap in try/catch as it can fail on Windows
111+
try {
112+
const output = execSync('npm ls -g', { encoding: 'utf-8' })
113+
if (output.includes('@wdio/cli')) {
114+
return true
115+
}
116+
} catch (err) {
117+
return false
113118
}
119+
114120
return false
115121
}
116-
}
122+
}

0 commit comments

Comments
 (0)