Module: Webgen::Utils::ExternalCommand
- Defined in:
- lib/webgen/utils/external_command.rb
Overview
This module provides methods for easily working with external commands.
Class Method Summary collapse
-
.ensure_available!(cmd, *args) ⇒ Object
Raise an error if the given command is not available.
Class Method Details
.ensure_available!(cmd, *args) ⇒ Object
Raise an error if the given command is not available.
This just checks if the exit status is zero.
15 16 17 18 |
# File 'lib/webgen/utils/external_command.rb', line 15 def self.ensure_available!(cmd, *args) status = systemu([cmd, *args], 'stdout' => '', 'stdin' => '') raise Webgen::CommandNotFoundError.new(cmd) if status.exitstatus != 0 end |