Project

Exit_0

0.0
No commit activity in last 3 years
No release in over 3 years
A simple method that runs a child process and raises Exit_0::Non_0 if $?.exitstatus is not zero.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.0
> 0.10.0

Runtime

> 1.3.0
 Project Readme

Exit_0

A simple method that raises Exit_0::Non_0 if $?.exitstatus is not 0.

Don't like Exit_0? Try:

Windows

Use something else. Check the previous list above for other alternatives, especialy POpen4, which is Windows and POSIX compatible.

Implementation

Exit_0 runs your command through bash:

Exit_0 "
  cd ~/
  pwd
"

# --> Your command is processed as:
str = str.split("\n").map(:strip).map(&:reject).join('&&')
"bash -lc #{str.inspect}"

Exit_0 lives in one file. So if you have any questions, here it is.

Installation

gem install Exit_0

Usage

require "Exit_0"

Exit_0 'uptime'
Exit_0 'ls', :input=>' /some/dir '
Exit_0 { system "uptime" }

# The following raises an error.
Exit_0 'uptimeSS'
Exit_0 { `uptimeSSS` }

# Exit_0 and Exit_0 are the same.
Exit_0 'uptime'
Exit_0 'grep a', :input=>"a \n b \n c"

# Get results from standard output, standard error.
Exit_0('uptime').out      # String is stripped.
Exit_0('uptimeSS').err    # String is stripped.

Exit_0('uptime').raw_out  # Raw string, no :strip used.
Exit_0('uptime').raw_err  # Raw string, no :strip used.

Run Tests

git clone git@github.com:da99/Exit_0.git
cd Exit_0
bundle update
bundle exec bacon spec/main.rb

"I hate writing."

If you know of existing software that makes the above redundant, please tell me. The last thing I want to do is maintain code.