mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-28 20:11:48 -04:00
fix: throw error if no TTY instead of terminating with 0 exit code (#9960)
close #9744
This commit is contained in:
5
.changeset/slimy-baths-tan.md
Normal file
5
.changeset/slimy-baths-tan.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/core": patch
|
||||
---
|
||||
|
||||
Throw a `ABORTED_REMOVE_MODULES_DIR_NO_TTY` error if there's no TTY instead of showing the prompt to ask for confirmation to remove the modules directory and immediately exiting with code 0.
|
||||
@@ -149,6 +149,11 @@ async function purgeModulesDirsOfImporters (
|
||||
importers: ImporterToPurge[]
|
||||
): Promise<void> {
|
||||
if (opts.confirmModulesPurge ?? true) {
|
||||
if (!process.stdin.isTTY) {
|
||||
throw new PnpmError('ABORTED_REMOVE_MODULES_DIR_NO_TTY', 'Aborted removal of modules directory due to no TTY', {
|
||||
hint: 'If you are running pnpm in CI, set the CI environment variable to "true".',
|
||||
})
|
||||
}
|
||||
const confirmed = await enquirer.prompt<{ question: boolean }>({
|
||||
type: 'confirm',
|
||||
name: 'question',
|
||||
|
||||
Reference in New Issue
Block a user