fix: print more details when a bin file cannot be created (#6801)

This commit is contained in:
Zoltan Kochan
2023-07-13 02:26:22 +03:00
committed by GitHub
parent b8cb91cf48
commit e26d15c6da
2 changed files with 8 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/link-bins": patch
"pnpm": patch
---
When a command cannot be created in `.bin`, print the exact error message that happened.

View File

@@ -217,7 +217,7 @@ async function linkBin (cmd: CommandInfo, binsDir: string, opts?: LinkBinOptions
if (err.code !== 'ENOENT') {
throw err
}
globalWarn(`Failed to create bin at ${externalBinPath}. The source file at ${cmd.path} does not exist.`)
globalWarn(`Failed to create bin at ${externalBinPath}. ${err.message as string}`)
}
return
}
@@ -241,7 +241,7 @@ async function linkBin (cmd: CommandInfo, binsDir: string, opts?: LinkBinOptions
if (err.code !== 'ENOENT') {
throw err
}
globalWarn(`Failed to create bin at ${externalBinPath}. The source file at ${cmd.path} does not exist.`)
globalWarn(`Failed to create bin at ${externalBinPath}. ${err.message as string}`)
return
}
// ensure that bin are executable and not containing