Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Disable only header/footer in nested commands, not all output #4811

Merged
merged 4 commits into from
Nov 1, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cli/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg
}

if (cmds.length) {
// propagate YARN_SILENT env variable to executed commands
process.env.YARN_SILENT = '1';
// Disable wrapper in executed commands
process.env.YARN_WRAPOUTPUT = '0';
for (const [stage, cmd] of cmds) {
// only tack on trailing arguments for default script, ignore for pre and post - #1595
const cmdWithArgs = stage === action ? sh`${unquoted(cmd)} ${args}` : cmd;
Expand Down
3 changes: 2 additions & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ export function main({
reporter.initPeakMemoryCounter();

const config = new Config(reporter);
const outputWrapper = !commander.json && command.hasWrapper(commander, commander.args);
const outputWrapperEnv = process.env.YARN_WRAPOUTPUT === undefined || process.env.YARN_WRAPOUTPUT == '1';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go with the following:

const disableOutputWrapper = process.env.YARN_WRAPOUTPUT === '0' || process.env.YARN_WRAPOUTPUT === 'false';
const shouldWrapOutput = !disableOutputWrapper && !commander.json && command.hasWrapper(commander, commander.args);

if (shouldWrapOutput) {

const outputWrapper = !commander.json && outputWrapperEnv && command.hasWrapper(commander, commander.args);

if (outputWrapper) {
reporter.header(commandName, {name: 'yarn', version});
Expand Down