Skip to content
Ergonomic shell wrapper for Ruby.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Fix reporting binary Jun 22, 2019
bin Use Pry for console Jun 22, 2019
lib Bump version 0.9 Jun 22, 2019
spec Add Rubocop Jun 22, 2019
.gitignore Add parametrization Jun 18, 2019
.rspec Initial commit Jun 18, 2019
.rubocop.yml Add Rubocop Jun 22, 2019 Initial commit Jun 18, 2019
Gemfile Add Rubocop Jun 22, 2019
Gemfile.lock Bump version 0.9 Jun 22, 2019
LICENSE.txt Initial commit Jun 18, 2019 Mention string escaping in README Jun 22, 2019
Rakefile Add Rubocop Jun 22, 2019
scallop.gemspec Bump version 0.9 Jun 22, 2019
scallop.png Update README Jun 22, 2019

Gem Version CircleCI Maintainability Test Coverage


Ergonomic shell wrapper.


  • Easy access to command's output (stdout & stderr)
  • Failure handling
  • Parameterization
  • Measuring execution time
  • Built-in string escaping
  • No dependencies


Add this line to your application's Gemfile:

gem 'scallop'

And then execute:

$ bundle

Or install it yourself as:

$ gem install scallop


To run sudo -u chuck grep -R /home/chuck

result = Scallop.sudo(:chuck).cmd(:grep, '-R', '/home/chuck').run

You can then check whether command succeeded


See its output

result.output # STDOUT and STDERR combined

You can also access information about command execution time

result.timing.real # Elapsed real time
result.timing.stime # System CPU time
result.timing.utime # User CPU time # Total time, that is utime + stime + cutime + cstime

Handling failures with exceptions

If you replace run with run!, exception will be raised in case command fails

rescue Scallop::Errors::CommandFailed => error
  # you can access result right on the error itself


To run cat /some/file | grep something

command = Scallop.cmd(:cat, '/some/file') | Scallop.cmd(:grep, 'something')


stored_command = Scallop.cmd(:rm, '-rf', Scallop::Param[:path])

stored_command.set(path: '/foo').run # rm -rf /foo
stored_command.set(path: '/bar').run # rm -rf /bar

You can also check specs for examples.

You can’t perform that action at this time.