Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .changeset/cold-buckets-crash.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/cruel-seas-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pnpm/worker": patch
---

`WMIC` has been deprecated and replaced by PowerShell commands.
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions tools/plugin-commands-self-updater/src/installPnpmToTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function installPnpmToTools (pnpmVersion: string, opts: SelfUpdateC
try {
// The reason we don't just run add.handler is that at this point we might have settings from local config files
// that we don't want to use while installing the pnpm CLI.
const command = [
runPnpmCli([
'add',
`${currentPkgName}@${pnpmVersion}`,
'--loglevel=error',
Expand All @@ -52,15 +52,7 @@ export async function installPnpmToTools (pnpmVersion: string, opts: SelfUpdateC
// which breaks the junctions on Windows.
'--config.node-linker=hoisted',
'--config.bin=bin',
]
// Respect user's registry configuration when installing pnpm itself.
// This is important when the user has configured a custom registry (e.g., a mirror)
// in their .npmrc file, as the temporary directory is outside the project and won't
// automatically pick up the project's .npmrc configuration.
if (opts.registries?.default) {
command.push(`--config.registry=${opts.registries.default}`)
}
runPnpmCli(command, { cwd: stage })
], { cwd: stage })
// We need the operation of installing pnpm to be atomic.
// However, we cannot use a rename as that breaks the command shim created for pnpm.
// Hence, we use a symlink.
Expand Down
3 changes: 1 addition & 2 deletions worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down
8 changes: 5 additions & 3 deletions worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down