Class: XcodeArchiveCache::Shell::Executor
- Inherits:
-
Object
- Object
- XcodeArchiveCache::Shell::Executor
- Defined in:
- lib/shell/executor.rb
Instance Method Summary collapse
-
#execute(command, print_command = false) ⇒ Boolean
True if command succeeded and returned 0, false otherwise.
- #execute_for_output(command, print_command = false) ⇒ String
-
#execute_with_env(command, env) ⇒ Boolean
True if command succeeded and returned 0, false otherwise.
Instance Method Details
#execute(command, print_command = false) ⇒ Boolean
Returns true if command succeeded and returned 0, false otherwise.
26 27 28 29 30 31 32 |
# File 'lib/shell/executor.rb', line 26 def execute(command, print_command = false) actual_command = extend_for_pipefail(command, print_command) result = system actual_command return false if result == nil result end |
#execute_for_output(command, print_command = false) ⇒ String
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/shell/executor.rb', line 10 def execute_for_output(command, print_command = false) actual_command = extend_for_pipefail(command, print_command) output, status = Open3.capture2e(actual_command) if status.exitstatus != 0 raise XcodeArchiveCache::Informative, "#{command}\nexecution failed\n#{output}" end output end |
#execute_with_env(command, env) ⇒ Boolean
Returns true if command succeeded and returned 0, false otherwise.
39 40 41 42 43 44 |
# File 'lib/shell/executor.rb', line 39 def execute_with_env(command, env) result = system(env, "set -x && '#{command}'") return false if result == nil result end |