Module: Sheller
- Defined in:
- lib/sheller.rb
Defined Under Namespace
Classes: ShellerResult
Constant Summary collapse
- VERSION =
'0.0.5'
- INESCAPABLE =
{}
- SHELL_SAFE =
/\A[0-9A-Za-z+,.\/:=@_-]+\z/
- ARG_SCAN =
/('+)|[^']+/
Class Method Summary collapse
- .command(*args) ⇒ Object (also: quote)
- .execute(*args) ⇒ Object
Class Method Details
.command(*args) ⇒ Object Also known as: quote
27 28 29 |
# File 'lib/sheller.rb', line 27 def command(*args) args.map { |a| arg_to_cmd(a) }.join(' ') end |
.execute(*args) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/sheller.rb', line 32 def execute(*args) stdout, stderr = nil shell_command = command(*args) status = POpen4.popen4(shell_command) do |_stdout, _stderr, _stdin, _pid| stdout = _stdout.read stderr = _stderr.read end ShellerResult.new(stdout, stderr, status, shell_command) end |