exec
exec
Simple library to execute a program with arguments from Crystal
Installation
Add this block to your application's shard.yml
:
dependencies:
exec:
github: j8r/exec
Usage
Methods
out(strict = false)
: return the output (stdout) of the process as a String
if exited normally with an exit code of 0, else return the error (stderr) or raise the error when strict = true
exit_code
, exit_signal
, exit_status
, normal_exit?
, signal_exit?
, success?
: same as the ones in the official Crystal API docs
Examples
Exec.new("/bin/true").success? # true
Exec.new("/bin/ls", ["/tmp", "-lh"]).exit_status # 0
Exec.new("/bin/pwd", "", "/tmp").out # "/tmp\n"
License
Copyright (c) 2017 Julien Reichardt - ISC License