Giter Club home page Giter Club logo

Comments (3)

genivia-inc avatar genivia-inc commented on June 1, 2024 1

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.

genivia-inc avatar genivia-inc commented on June 1, 2024

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.

genivia-inc avatar genivia-inc commented on June 1, 2024

Fixed in v5.1.2

from ugrep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.