diff --git a/.yarn/versions/d5fa480f.yml b/.yarn/versions/d5fa480f.yml new file mode 100644 index 000000000000..6382dce07ce9 --- /dev/null +++ b/.yarn/versions/d5fa480f.yml @@ -0,0 +1,34 @@ +releases: + "@yarnpkg/cli": patch + "@yarnpkg/core": patch + "@yarnpkg/plugin-essentials": patch + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-exec" + - "@yarnpkg/plugin-file" + - "@yarnpkg/plugin-git" + - "@yarnpkg/plugin-github" + - "@yarnpkg/plugin-http" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-link" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/doctor" + - "@yarnpkg/extensions" + - "@yarnpkg/nm" + - "@yarnpkg/pnpify" + - "@yarnpkg/sdks" diff --git a/packages/plugin-essentials/sources/commands/add.ts b/packages/plugin-essentials/sources/commands/add.ts index 36f0049268e1..e65eb7bbc7bf 100644 --- a/packages/plugin-essentials/sources/commands/add.ts +++ b/packages/plugin-essentials/sources/commands/add.ts @@ -137,6 +137,7 @@ export default class AddCommand extends BaseCommand { const fixed = this.fixed; const interactive = configuration.isInteractive({ interactive: this.interactive, + stdin: this.context.stdin, stdout: this.context.stdout, }); const reuse = interactive || configuration.get(`preferReuse`); diff --git a/packages/plugin-essentials/sources/commands/up.ts b/packages/plugin-essentials/sources/commands/up.ts index adc95c12406f..00e3f429ec4e 100644 --- a/packages/plugin-essentials/sources/commands/up.ts +++ b/packages/plugin-essentials/sources/commands/up.ts @@ -164,6 +164,7 @@ export default class UpCommand extends BaseCommand { const fixed = this.fixed; const interactive = configuration.isInteractive({ interactive: this.interactive, + stdin: this.context.stdin, stdout: this.context.stdout, }); diff --git a/packages/yarnpkg-core/sources/Configuration.ts b/packages/yarnpkg-core/sources/Configuration.ts index afdc21da250a..55a2991c316d 100644 --- a/packages/yarnpkg-core/sources/Configuration.ts +++ b/packages/yarnpkg-core/sources/Configuration.ts @@ -7,8 +7,8 @@ import {UsageError} import {parse as parseDotEnv} from 'dotenv'; import {builtinModules} from 'module'; import pLimit, {Limit} from 'p-limit'; -import {PassThrough, Writable} from 'stream'; -import {WriteStream} from 'tty'; +import {PassThrough, Readable, Writable} from 'stream'; +import {ReadStream, WriteStream} from 'tty'; import {CorePlugin} from './CorePlugin'; import {Manifest, PeerDependencyMeta} from './Manifest'; @@ -1790,7 +1790,10 @@ export class Configuration { return {os, cpu, libc}; } - isInteractive({interactive, stdout}: {interactive?: boolean, stdout: Writable}): boolean { + isInteractive({interactive, stdin, stdout}: {interactive?: boolean, stdin: Readable, stdout: Writable}): boolean { + if (!(stdin as ReadStream).isTTY) + return false; + if (!(stdout as WriteStream).isTTY) return false;