Giter Club home page Giter Club logo

pipe-run's Introduction

Pipe Run

Pipe Run runs command and returns its standard output in one call:

require "pipe-run"

stdout = Pipe.run("date")       # blocking
puts stdout         # will print out for example 'Thu Feb 17 17:22:18 CET 2011'

stdout, errout = Pipe.run2("date")       # blocking
puts stdout         # will print out for example 'Thu Feb 17 17:22:18 CET 2011'

Asynchronous Use

In case, eventmachine is available, non-blocking run of the command is possible using #run_nonblock or #run with block given, defined in em-pipe-run file. So for example:

EM::run do
    Pipe.run("date") do |stdout|    # non-blocking
        puts stdout     # will print out for example 'Thu Feb 17 17:22:18 CET 2011'
    end
    
    Pipe.run2("date") do |stdout, errout|    # non-blocking
        puts stdout     # will print out for example 'Thu Feb 17 17:22:18 CET 2011'
    end
end

Contributing

  1. Fork it.
  2. Create a branch (git checkout -b 20101220-my-change).
  3. Commit your changes (git commit -am "Added something").
  4. Push to the branch (git push origin 20101220-my-change).
  5. Create an Issue with a link to your branch.
  6. Enjoy a refreshing Diet Coke and wait.

Copyright

Copyright © 2010 – 2011 Martin Kozák. See LICENSE.txt for further details.

pipe-run's People

Contributors

martinpoljak avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.