Sha256: 9afd0c9fbb0298980fb503c8b7f75aeda6a6a82f4f61ad652fe39871a8078d2e

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

Half Shell
=========

`half_shell` is a simple ruby gem for executing shell commands

Installation:

    gem install half_shell

Examples:

    require 'half_shell'
    
    # execute a command and capture the result
    result = HalfShell.execute 'ls'
     => #<HalfShell::Result:0x101270f18 @stdout="Gemfile\nGemfile.lock\nREADME.md\nRakefile\nbenchmark.rb\ncoverage\nhalf_shell.gemspec\nlib\ntest\n", @status=0, @command="ls", @stderr="">
    
    # status
    result.status
     => 0
    
    # stdout
    result.stdout
     => "Gemfile\nGemfile.lock\nREADME.md\nRakefile\nbenchmark.rb\ncoverage\nhalf_shell.gemspec\nlib\ntest\n"
     
    # stderr
    result.stderr
     => ""
    
    # raise an exception if the command exits with a non-zero status code
    HalfShell.execute '(exit 123)'
     => HalfShell::ExecuteError: command <(exit 123)> failed with status <123>
    
    # don't raise an exception if the command exits with a non-zero status code
    HalfShell.execute '(exit 123)', :raise => false
     => #<HalfShell::Result:0x1012380a0 @stdout="", @status=123, @command="(exit 123)", @stderr="">
     
    # execute a command, but only care about the status
    HalfShell.execute! 'ls'
     => true
    
    HalfShell.execute! '(exit 123)'
     => false

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
half_shell-0.0.3 README.md