Class: Kettle::Family::CommandRunner
- Inherits:
-
Object
- Object
- Kettle::Family::CommandRunner
- Defined in:
- lib/kettle/family/command_runner.rb
Defined Under Namespace
Classes: OtpCoordinator
Constant Summary collapse
- SENSITIVE_ENV_KEYS =
[ "KETTLE_RELEASE_GEM_SIGNING_PASSPHRASE" ].freeze
Instance Method Summary collapse
- #call(member:, phase:, command:, env: {}, interactive: false, stdout_line_handler: nil) ⇒ Object
-
#initialize(execute: false, accept: true, gem_signing_password: nil, otp_coordinator: nil) ⇒ CommandRunner
constructor
A new instance of CommandRunner.
Constructor Details
#initialize(execute: false, accept: true, gem_signing_password: nil, otp_coordinator: nil) ⇒ CommandRunner
Returns a new instance of CommandRunner.
120 121 122 123 124 125 |
# File 'lib/kettle/family/command_runner.rb', line 120 def initialize(execute: false, accept: true, gem_signing_password: nil, otp_coordinator: nil) @execute = execute @accept = accept @gem_signing_password = gem_signing_password @otp_coordinator = otp_coordinator end |
Instance Method Details
#call(member:, phase:, command:, env: {}, interactive: false, stdout_line_handler: nil) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/kettle/family/command_runner.rb', line 127 def call(member:, phase:, command:, env: {}, interactive: false, stdout_line_handler: nil) argv = command_argv(member: member, command: command, env: env) process_env = process_env(member: member, env: env) = return skipped_result(member: member, phase: phase, argv: argv) unless execute started = Process.clock_gettime(Process::CLOCK_MONOTONIC) stdout, stderr, status = if interactive run_interactive( env: process_env, argv: argv, chdir: member.root, member_name: member.name, process_options: , stdout_line_handler: stdout_line_handler ) elsif stdout_line_handler run_streaming(env: process_env, argv: argv, chdir: member.root, process_options: , stdout_line_handler: stdout_line_handler) else Open3.capture3(process_env, *argv, chdir: member.root, **) end stdout = normalize_output(stdout) stderr = normalize_output(stderr) elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started CommandResult.new( member_name: member.name, phase: phase, command: argv, workdir: member.root, status: status.exitstatus, success: status.success?, stdout: stdout, stderr: stderr, elapsed_seconds: elapsed.round(3), skipped: false, reason: status.success? ? nil : "command failed", output_streamed: interactive ) end |