mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 23:47:54 +08:00
make edge on windows can be used as puppeteer executable
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import * as childProcess from 'node:child_process'
|
||||
|
||||
export const getExecutableFileVersion = async (p) => {
|
||||
const path = await import('node:path/win32')
|
||||
p = path.resolve(p).replaceAll('\\', '\\\\')
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
childProcess.exec(
|
||||
`wmic datafile where Name="${
|
||||
p
|
||||
}" get Version /format:list`,
|
||||
(err, stdout) => {
|
||||
if (err) {
|
||||
console.log(err)
|
||||
reject(err)
|
||||
} else {
|
||||
const lines = stdout.trim().split('\n').map(it => it.split('='))
|
||||
const versionLine = lines.find(ln => ln[0] === 'Version')
|
||||
resolve(versionLine?.[1])
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user