Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6151505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:46:39+00:00 2026-05-23T19:46:39+00:00

I just started today looking into Groovy. I consider using it to replace some

  • 0

I just started today looking into Groovy. I consider using it to replace some of my more complex bash scripts.

One of its very interesting concepts for me is the possibility to use pipes easily:

proc1 = 'ls'.execute()
proc2 = 'tr -d o'.execute()
proc3 = 'tr -d e'.execute()
proc4 = 'tr -d i'.execute()
proc1 | proc2 | proc3 | proc4
proc4.waitFor()

That’s amazing. But my question is: Does this use real UNIX pipes (when run e.g. on Linux), or is this just a simulation with Java streams? (And if so, is it much slower/more inefficient?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:46:40+00:00Added an answer on May 23, 2026 at 7:46 pm

    Due to operator overloading, it eventually calls into ProcessGroovyMethods.pipeTo() in the Groovy runtime, which does indeed simulate pipes using java streams:

        /**
         * Allows one Process to asynchronously pipe data to another Process.
         *
         * @param left  a Process instance
         * @param right a Process to pipe output to
         * @return the second Process to allow chaining
         * @throws java.io.IOException if an IOException occurs.
         * @since 1.5.2
         */
        public static Process pipeTo(final Process left, final Process right) throws IOException {
            new Thread(new Runnable() {
                public void run() {
                    InputStream in = new BufferedInputStream(getIn(left));
                    OutputStream out = new BufferedOutputStream(getOut(right));
                    byte[] buf = new byte[8192];
                    int next;
                    try {
                        while ((next = in.read(buf)) != -1) {
                            out.write(buf, 0, next);
                        }
                    } catch (IOException e) {
                        throw new GroovyRuntimeException("exception while reading process stream", e);
                    } finally {
                        closeWithWarning(out);
                    }
                }
            }).start();
            return right;
        }
    

    I can’t speak to the amount of overhead involved off the top of my head though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started getting this error today, seemingly out of nowhere. Any one see
I just started playing around with threading today and I ran into something that
Just today I've started using Drupal for a site I'm designing/developing. For my own
I've just (as in today) started working on some ZF stuff. I have a
I am just started out learning Python and also started looking into Django a
I just started learning Ruby and I ran into a problem today. numResults =
Just started using AJAX today via JQuery and I am getting nowhere. As an
I've just started looking at hooks today not 100% sure what I'm doing wrong
I have just started using PowerShell today, and I have an intention list files
I've just started using Jenkins today, so it's entirely possible that I've missed something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.