In my case, there is no -quiet mode. So I had to use -interaction=batchmode argument as suggeseted by Andrew's comment.
But then another problem arised - you will not see what went wrong and why, because errors are also suppressed with batchmode.
The result I end up using is to suppress all pdflatex's output by using grep to output only errors:
: | pdflatex -halt-on-error src.tex | grep '^!.*' -A200 --color=always
I use -halt-on-error because you basically can't use interactive mode in case of error (grep disables dialog between program and user). Also, to make sure that pdflatex does never prompt for the input, let's pipe in command with no output (: command).
Let me also explain the grep arguments:
^!.*
- string to search for in the output from pdflatex
- it matches all lines that start with
!, which are considered error lines
-A200
- output 200 lines after every match
- this way I make sure to print also the relevant information followed after the matched error lines
--color=always
- this provides us colored output so that we can clearly see what went wrong and why - the problem is bold red
Wrapper script
I've created a wrapper script to provide more convenient solution exactly for this purpose. It's usage is almost the same as pdflatex / pdftex itself. You can check it out as a CTAN package or as a GitLab repository.
Quickinstall
And here is how to install the latest version using this oneliner:
curl -s https://gitlab.com/jirislav/pdftex-quiet/raw/latest/pdftex-quiet | \
sudo tee /usr/local/bin/pdftex-quiet >/dev/null \
&& sudo chmod +x /usr/local/bin/pdftex-quiet \
&& sudo ln -sf /usr/local/bin/pdftex-quiet /usr/local/bin/pdflatex-quiet
Here is an example of how you run the wrapper script:
pdftex-quiet compile-me.tex
# You may also provide additional attributes to `pdflatex`
pdflatex-quiet -output-format=dvi -output-directory=/tmp compile-me.tex
You can also show version or help of the pdflatex-quiet / pdftex-quiet script:
pdflatex-quiet -v # or --version
pdflatex-quiet -h # or --help
Also the difference between pdflatex-quiet and pdftex-quiet, as explained here is respected - thanks to Denis Bitouzé's comment.
"pdflatex: unrecognized option '-quiet'"
– Mar 19 '14 at 08:19pdflatexversion, but the Arch Linux TeXLive version does not have it indeed. Then redirecting output is your only option. You can leave out the2>&1bit if you still want to show errors (and maybe warnings, depending on howpdflatexoutputs them). – rubenvb Mar 19 '14 at 08:36pdflatex --interaction=batchmode ...hides almost all of the output – Mar 02 '17 at 01:51