mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-06 22:18:17 -05:00
7
.changeset/honest-foxes-own.md
Normal file
7
.changeset/honest-foxes-own.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-script-runners": patch
|
||||
"@pnpm/store-path": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fix issue when trying to use `pnpm dlx` in the root of a Windows Drive [#7263](https://github.com/pnpm/pnpm/issues/7263).
|
||||
@@ -4,6 +4,8 @@ import { dlx } from '@pnpm/plugin-commands-script-runners'
|
||||
import { prepareEmpty } from '@pnpm/prepare'
|
||||
import { DLX_DEFAULT_OPTS as DEFAULT_OPTS } from './utils'
|
||||
|
||||
const testOnWindowsOnly = process.platform === 'win32' ? test : test.skip
|
||||
|
||||
test('dlx', async () => {
|
||||
prepareEmpty()
|
||||
|
||||
@@ -121,3 +123,13 @@ test('dlx should return a non-zero exit code when the underlying script fails',
|
||||
|
||||
expect(exitCode).toBe(1)
|
||||
})
|
||||
|
||||
testOnWindowsOnly('dlx should work when running in the root of a Windows Drive', async () => {
|
||||
prepareEmpty()
|
||||
|
||||
await dlx.handler({
|
||||
...DEFAULT_OPTS,
|
||||
dir: 'C:\\',
|
||||
storeDir: path.resolve('store'),
|
||||
}, ['cowsay', 'hello'])
|
||||
})
|
||||
@@ -40,7 +40,7 @@ export function getStorePath (
|
||||
|
||||
async function storePathRelativeToHome (pkgRoot: string, relStore: string, homedir: string) {
|
||||
const tempFile = pathTemp(pkgRoot)
|
||||
await fs.mkdir(path.dirname(tempFile), { recursive: true })
|
||||
if (path.parse(pkgRoot).root !== pkgRoot) await fs.mkdir(path.dirname(tempFile), { recursive: true })
|
||||
await touch(tempFile)
|
||||
const storeInHomeDir = path.join(homedir, relStore, STORE_VERSION)
|
||||
if (await canLinkToSubdir(tempFile, homedir)) {
|
||||
|
||||
Reference in New Issue
Block a user