Comments (3)
Adding this to the filter()
method at ugrep.cpp:3795 suppresses error messages sent by the filter to stderr when ugrep option -q
or -s
is used:
// -q or -q: suppress error messages sent to stderr by the filter command
if (flag_quiet || flag_no_messages)
{
int dev_null = open("/dev/null", O_WRONLY);
if (dev_null >= 0)
{
dup2(dev_null, STDERR_FILENO);
close(dev_null);
}
}
That needs to be added right after this part:
// dup the writing end of the pipe to stdout
dup2(fd[1], STDOUT_FILENO);
close(fd[1]);
from ugrep.
These messages are generated by the pdftotext
tool that is executed as a filter with --filter=pdf:pdftotext
. It has a -q
switch to turn error messages off, but that is not done with ug+ -q
because ug+
is a script.
This should work for you by using ug
instead of ug+
:
$ ug --filter='pdf:pdftotext -q % -' PATTERN [FILES...]
Perhaps add -tpdf
to only search PDF files.
Or send the pdftotext
error messages to dev/null on all *nix systems with 2>/dev/null
on the command line:
$ ug+ PATTERN [FILES...] 2>/dev/null
Error messages can be useful when PDFs have issues, but we could suppress them perhaps with -q
in the ug+
script itself. A more advanced way of suppressing is to fork pdftotext
as usual but then send stderr to /dev/null when ugrep option -q
or -s
is specified. Don't know what's best or what people want.
from ugrep.
Fixed in v5.1.2
from ugrep.
Related Issues (20)
- background coloring artifact due to scrolling when the first character of a continuation line is matched HOT 14
- Are ugrep SSE and AVX binaries portable to non-SSE2 CPUs? HOT 8
- [RFE] block matching in ugrep HOT 18
- Unresolved boost_regex symbol HOT 8
- [FR] Have portable, statically-linked releases for Linux HOT 2
- build fails on AIX HOT 12
- `ug -TrinΞ` is invalid, but `ug -ITrin` isn't? HOT 2
- max-count across all files HOT 2
- inquiry on saving the output interactive HOT 4
- Ugrep search throws error -z option not available in new Homebrew ugrep v5.1.2 HOT 16
- ugrep 5.1.3 FTFBS with musl HOT 2
- -A may not show the context line for this pattern HOT 4
- [FR] 90% speed up by refactoring and optimizing some code HOT 2
- easier windows install HOT 6
- valgrind: Source and destination overlap in memcpy - Zthread::decompress() (ugrep.cpp:1205) HOT 3
- Zsh completion doesn't complete flags after positional arguments HOT 5
- Use `--and` with `-g`. HOT 1
- Bash autocompletion lost --no-confirm HOT 7
- Bash autocompletion performance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ugrep.