mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
fix: WMIC is being removed (#10223)
* fix: `WMI` is being removed * fix: update * fix: update * fix: validate drive before usage * fix: remove not needed dep * refactor: regex --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
5
.changeset/cruel-seas-leave.md
Normal file
5
.changeset/cruel-seas-leave.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/worker": patch
|
||||
---
|
||||
|
||||
`WMIC` has been deprecated and replaced by PowerShell commands.
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -8730,9 +8730,6 @@ importers:
|
||||
p-limit:
|
||||
specifier: 'catalog:'
|
||||
version: 7.1.0
|
||||
shlex:
|
||||
specifier: 'catalog:'
|
||||
version: 3.0.0
|
||||
devDependencies:
|
||||
'@pnpm/logger':
|
||||
specifier: workspace:*
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
"@pnpm/symlink-dependency": "workspace:*",
|
||||
"@rushstack/worker-pool": "catalog:",
|
||||
"is-windows": "catalog:",
|
||||
"p-limit": "catalog:",
|
||||
"shlex": "catalog:"
|
||||
"p-limit": "catalog:"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@pnpm/logger": "catalog:"
|
||||
|
||||
@@ -8,7 +8,6 @@ import isWindows from 'is-windows'
|
||||
import { type PackageFilesIndex } from '@pnpm/store.cafs'
|
||||
import { type DependencyManifest } from '@pnpm/types'
|
||||
import pLimit from 'p-limit'
|
||||
import { join as shellQuote } from 'shlex'
|
||||
import {
|
||||
type TarballExtractMessage,
|
||||
type AddDirToStoreMessage,
|
||||
@@ -269,11 +268,14 @@ function createErrorHint (err: Error, checkedDir: string): string | undefined {
|
||||
|
||||
// In Windows system exFAT drive, symlink will result in error.
|
||||
function isDriveExFat (drive: string): boolean {
|
||||
if (!/^[a-z]:$/i.test(drive)) {
|
||||
throw new Error(`${drive} is not a valid disk on Windows`)
|
||||
}
|
||||
try {
|
||||
// cspell:disable-next-line
|
||||
const output = execSync(`wmic logicaldisk where ${shellQuote([`DeviceID='${drive}'`])} get FileSystem`).toString()
|
||||
const output = execSync(`powershell -Command "Get-Volume -DriveLetter ${drive.replace(':', '')} | Select-Object -ExpandProperty FileSystem"`).toString()
|
||||
const lines = output.trim().split('\n')
|
||||
const name = lines.length > 1 ? lines[1].trim() : ''
|
||||
const name = lines[0].trim()
|
||||
return name === 'exFAT'
|
||||
} catch {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user