Module: Lich::Main::ReconnectCommand Private
- Defined in:
- documented/main/reconnect_command.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Builds the argv used when replacing a reconnecting Lich process.
Class Method Summary collapse
-
.build(argv:, program:, ruby_executable:, reconnect_arg:, reconnect_delay:, reconnect_step:) ⇒ Array<String>
private
Builds reconnect argv without shell re-parsing or mutating caller input.
-
.log_line(args) ⇒ String
private
Renders exec argv as a log-safe string, masking credential-bearing entries.
-
.ruby_executable(platform_key: Lich::Common::Frontend.platform_key, configured_ruby: RbConfig.ruby) ⇒ String
private
Selects the current Ruby executable, preferring rubyw.exe on Windows when that companion executable is actually installed.
Class Method Details
.build(argv:, program:, ruby_executable:, reconnect_arg:, reconnect_delay:, reconnect_step:) ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Builds reconnect argv without shell re-parsing or mutating caller input.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'documented/main/reconnect_command.rb', line 38 def self.build(argv:, program:, ruby_executable:, reconnect_arg:, reconnect_delay:, reconnect_step:) raise ArgumentError, 'argv must be an Array' unless argv.is_a?(Array) raise ArgumentError, 'program must not be empty' if program.to_s.empty? raise ArgumentError, 'Ruby executable must not be empty' if ruby_executable.to_s.empty? begin delay = Integer(reconnect_delay) step = Integer(reconnect_step) rescue ArgumentError, TypeError raise ArgumentError, 'reconnect delay values must be integers' end raise ArgumentError, 'reconnect delay values must not be negative' if delay.negative? || step.negative? args = [ruby_executable, program, *argv] args << '--reconnected' unless args.include?('--reconnected') if step.positive? args.delete(reconnect_arg) unless reconnect_arg.nil? args << "--reconnect-delay=#{delay + step}+#{step}" end args end |
.log_line(args) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Renders exec argv as a log-safe string, masking credential-bearing entries.
Pairs with build: main.rb calls that method, logs this one, then execs the same, unredacted array on the next line. Keeping both here means a change to either stays covered by the same spec file, instead of the pairing only existing at the main.rb call site.
70 71 72 |
# File 'documented/main/reconnect_command.rb', line 70 def self.log_line(args) Lich::Common::CredentialScrub.redact_argv(args).join(' ') end |
.ruby_executable(platform_key: Lich::Common::Frontend.platform_key, configured_ruby: RbConfig.ruby) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Selects the current Ruby executable, preferring rubyw.exe on Windows when that companion executable is actually installed.
21 22 23 24 25 26 |
# File 'documented/main/reconnect_command.rb', line 21 def self.ruby_executable(platform_key: Lich::Common::Frontend.platform_key, configured_ruby: RbConfig.ruby) Lich::Common::RubyExecutable.resolve( platform_key: platform_key, configured_ruby: configured_ruby ) end |