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
Add --silent
flag to CLI run command
#788
Comments
Talked a bit with @cpojer on discord about exactly how silent something like this should be and he convinced me at least that this might not be a necessary thing for a cli to provide. Nothing that I could think of can't be handled by a Counterpoints? |
Ah, but I do care about the output. My use case here is that I'm running the test on a CI server and the output is an xml file. My command looks something like this:
Since yarn prints out the version and command the xml file generated by my test script has that in it before the xml output and I'm left with an invalid xml file. |
Also, terminal colors mess up the output when doing deploys here. Maybe it's something that should be addressed in the way my deploys are done but a simple
With npm you can do |
If stdout is not connected to a terminal then it should not use any control characters; just like npm does |
We would love to see this on many more of the yarn commands -- install, upgrade, and outdated come to mind. We use a bunch of private, internal modules, and to determine whether they are up-to-date, we run
The equivalent output in yarn looks like this:
The signal/noise ratio in the second example is much lower. We most definitely care about relevant output (in this case, outdated packages), and a way to silence the surrounding |
I found a really terrible way to work around this: "scripts": {
"command-that-captures-output": "cat $(yarn run command-that-yields-output 2>&1 >/dev/null)",
"command-that-yields-output": ">&2 echo ./path-to-a-file-we-care-about"
} The order of redirects is really important here. For Hope this helps! |
Status on this? When using Yarn for build scripts, it gets really noisy really fast. This is what happens when I run multiple scripts through watchers: And I'm just getting started. Every time I change a watched file, it reruns the yarn command with a bunch of output that makes it hard to read the stuff I care about—all the non-yarn output. Update I see that it's being worked on in #2420 w00t! |
fixed in #2420 |
@bestander this is fixed. we can close it! |
Thanks guys. this CHANGED MY LIFE. 😂 |
Did this get removed in 1.0? |
I'm not seeing the Did it get removed? |
@lmj0011 sorry, it is there. Just not documented. Filed yarnpkg/website#653 to track. |
Related issue : yarnpkg/yarn#788
Related issue : yarnpkg/yarn#788
|
The lack of a quiet option in Yarn is probably my least favorite thing about Yarn. I can get all my other commands in CI to be quiet (aside from errors) except for Yarn. It always wants to make noise, and it's totally unnecessary. |
@mojavelinux use the |
Sorry, but it doesn't. Yarn still makes all kinds of noise. What does work is to pipe to /dev/null.
That only outputs warnings and errors, which is exactly what I expect a |
For me, the noisy part is really that yarn outputs the whole first level of the dependency tree. This does not change with |
Chiming in since I was the one that implemented @bestander If this is a valid issue and you would like me to tackle it, feel free to create an issue and assign it to me. |
@arxpoetica You are talking about a script. I'm talking about Yarn add or install. I'll be honest, I've sort of given up on this feature since discovering I can just pipe to /dev/null. What I'm looking for is no output. That my understanding of what a |
Ah. Yes. Well, that would be different than what this ticket mentions which is |
it is really weird that the --silent has to be right after the yarn word. For everyone facing the same problem, this will help you: This does not work: but this works: |
Do you want to request a feature or report a bug?
feature
What is the current behavior?
I use the
npm test
command in my ember cli projects to run my tests. I was happy to see thatyarn test
works the same way asnpm test
but it's missing one feature that I use: the--silent
flag.When I run
yarn test --silent
(oryarn run test --silent
) it prints out the yarn version and command it runs:What is the expected behavior?
I would expect that when I run
yarn run <cmd> --silent
it would suppress the output of the yarn version and the command it is running, similar to hownpm run --silent
works.Please mention your node.js, yarn and operating system version.
Node: v4.6.0
Yarn: v0.15.1
OS: MacOS Sierra 10.12.0
The text was updated successfully, but these errors were encountered: