fix(dlx): don't fail when executed in a dir with no write access (#3668)

This commit is contained in:
Zoltan Kochan authored and GitHub committed 2021-08-13 13:52:10 +03:00
1 parent a4fed27983
commit b17096a36f
2 files changed
+7 -3

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@pnpm/plugin-commands-script-runners": patch
---
`pnpm dlx` should not fail when pnpm has no write access to the CWD.
@@ -1,6 +1,6 @@
import fs from 'fs'
import os from 'os'
import path from 'path'
import storePath from '@pnpm/store-path'
import rimraf from '@zkochan/rimraf'
import execa from 'execa'
import PATH from 'path-name'
@@ -41,8 +41,7 @@ export async function handler (
},
params: string[]
) {
const cache = path.join(await storePath(process.cwd(), '~/.pnpm-store'), 'tmp')
const prefix = path.join(cache, `dlx-${process.pid.toString()}`)
const prefix = path.join(os.tmpdir(), `dlx-${process.pid.toString()}`)
const bins = process.platform === 'win32'
? prefix
: path.join(prefix, 'bin')